cakephp2-php8/vendors/simpletest/test/collector_test.php
phpnut 57ef2eba9b merging changes from [428]
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@430 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-07-30 02:26:59 +00:00

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();
}
}
?>