mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
57ef2eba9b
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@430 3807eeeb-6ff5-0310-8944-8be069107fe0
59 lines
No EOL
1.9 KiB
PHP
59 lines
No EOL
1.9 KiB
PHP
<?php
|
|
// $Id: collector_test.php,v 1.7 2005/07/27 17:19:20 lastcraft Exp $
|
|
|
|
require_once(dirname(__FILE__) . '/../collector.php');
|
|
Mock::generate('GroupTest');
|
|
|
|
class PathEqualExpectation extends EqualExpectation {
|
|
function PathEqualExpectation($value, $message = '%s') {
|
|
$this->EqualExpectation(str_replace('\\', '/', $value), $message);
|
|
}
|
|
|
|
function test($compare) {
|
|
return parent::test(str_replace('\\', '/', $compare));
|
|
}
|
|
}
|
|
|
|
class TestOfCollector extends UnitTestCase {
|
|
|
|
function testCollectionIsAddedToGroup() {
|
|
$group = &new MockGroupTest($this);
|
|
$group->expectMinimumCallCount('addTestFile', 2);
|
|
$group->expectArguments(
|
|
'addTestFile',
|
|
array(new PatternExpectation('/collectable\\.(1|2)$/')));
|
|
|
|
$collector = &new SimpleCollector();
|
|
$collector->collect($group, dirname(__FILE__) . '/support/collector/');
|
|
|
|
$group->tally();
|
|
}
|
|
}
|
|
|
|
class TestOfPatternCollector extends UnitTestCase {
|
|
|
|
function testAddingEverythingToGroup() {
|
|
$group = &new MockGroupTest($this);
|
|
$group->expectCallCount('addTestFile', 2);
|
|
$group->expectArguments(
|
|
'addTestFile',
|
|
array(new PatternExpectation('/collectable\\.(1|2)$/')));
|
|
|
|
$collector = &new SimplePatternCollector();
|
|
$collector->collect($group, dirname(__FILE__) . '/support/collector/', '/.*/');
|
|
|
|
$group->tally();
|
|
}
|
|
|
|
function testOnlyMatchedFilesAreAddedToGroup() {
|
|
$group = &new MockGroupTest($this);
|
|
$group->expectOnce('addTestFile', array(new PathEqualExpectation(
|
|
dirname(__FILE__) . '/support/collector/collectable.1')));
|
|
|
|
$collector = &new SimplePatternCollector();
|
|
$collector->collect($group, dirname(__FILE__) . '/support/collector/', '/1$/');
|
|
|
|
$group->tally();
|
|
}
|
|
}
|
|
?>
|