Starting to move test suite manipulation methods into CakeTestSuite.

This commit is contained in:
mark_story 2010-09-25 00:00:08 -04:00
parent ca167d5da2
commit d7b958f55d

View file

@ -26,7 +26,8 @@ class CakeTestSuite extends PHPUnit_Framework_TestSuite {
protected $_fixtureManager = null;
/**
* Sets the intances for the fixture manager that will be used by this class
* Sets the intances for the fixture manager that will be used by this class.
*
* @param CakeFixtureManager $manager the instance of the manager class
* @return void
* @access public
@ -35,6 +36,24 @@ class CakeTestSuite extends PHPUnit_Framework_TestSuite {
$this->_fixtureManager = $manager;
}
/**
* Adds all the files in a directory to the test suite. Does not recurse through directories.
*
* @param string $directory The directory to add tests from.
* @return void
*/
public function addTestDirectory($directory = '.') {
$files = new DirectoryIterator($directory);
foreach ($files as $file) {
if (!$file->isFile()) {
continue;
}
$file = $file->getRealPath();
$this->addTestFile($file);
}
}
/**
* Method that is called before the tests of this test suite are run.
* It will load fixtures accordingly for each test