isDot() && !$file->isDir() && (string) $file !== 'DwooTests.php' && substr((string) $file, -4) === '.php') { require_once $file->getPathname(); $suite->addTestSuite(basename($file, '.php')); } } return $suite; } protected function tearDown() { $this->clearDir(TEST_DIRECTORY.'/temp/compiled', true); } protected function clearDir($path, $emptyOnly=false) { if(is_dir($path)) { foreach(glob($path.'/*') as $f) $this->clearDir($f); if(!$emptyOnly) rmdir($path); } else unlink($path); } } // Evaluates two strings and ignores differences in line endings (\r\n == \n == \r) class DwooConstraintStringEquals extends PHPUnit_Framework_Constraint { protected $target; public function __construct($target) { $this->target = preg_replace('#(\r\n|\r)#', "\n", $target); } public function evaluate($other) { $this->other = preg_replace('#(\r\n|\r)#', "\n", $other); return $this->target == $this->other; } public function toString() { return 'equals "'.$this->target.'" / "'.$this->other.'"'; } }