Exemple #1
0
 public function testGetSrcDirectoryIterators()
 {
     $this->if($field = new testedClass(uniqid(), uniqid()))->then->array($field->getSrcDirectoryIterators())->isEmpty()->if($field->addSrcDirectory($directory = __DIR__))->then->array($iterators = $field->getSrcDirectoryIterators())->isEqualTo(array(new \recursiveIteratorIterator(new atoum\iterators\filters\recursives\closure(new \recursiveDirectoryIterator($directory)))))->array(current($iterators)->getClosures())->isEmpty()->if($field->addSrcDirectory($directory, $closure = function () {
     }))->then->array($iterators = $field->getSrcDirectoryIterators())->isEqualTo(array(new \recursiveIteratorIterator(new atoum\iterators\filters\recursives\closure(new \recursiveDirectoryIterator($directory)))))->array(current($iterators)->getClosures())->isEqualTo(array($closure))->if($field->addSrcDirectory($otherDirectory = __DIR__ . DIRECTORY_SEPARATOR . '..', $otherClosure = function () {
     }))->then->array($iterators = $field->getSrcDirectoryIterators())->isEqualTo(array(new \recursiveIteratorIterator(new atoum\iterators\filters\recursives\closure(new \recursiveDirectoryIterator($directory))), new \recursiveIteratorIterator(new atoum\iterators\filters\recursives\closure(new \recursiveDirectoryIterator($otherDirectory)))))->array(current($iterators)->getClosures())->isEqualTo(array($closure))->array(next($iterators)->getClosures())->isEqualTo(array($otherClosure))->if($field->addSrcDirectory($otherDirectory, $anOtherClosure = function () {
     }))->then->array($iterators = $field->getSrcDirectoryIterators())->isEqualTo(array(new \recursiveIteratorIterator(new atoum\iterators\filters\recursives\closure(new \recursiveDirectoryIterator($directory))), new \recursiveIteratorIterator(new atoum\iterators\filters\recursives\closure(new \recursiveDirectoryIterator($otherDirectory)))))->array(current($iterators)->getClosures())->isEqualTo(array($closure))->array(next($iterators)->getClosures())->isEqualTo(array($otherClosure, $anOtherClosure));
 }
Exemple #2
0
 public function testAddSrcDirectory()
 {
     $this->if($field = new coverage\html(uniqid(), uniqid()))->then->object($field->addSrcDirectory($srcDirectory = uniqid()))->isIdenticalTo($field)->array($field->getSrcDirectories())->isEqualTo(array($srcDirectory => array()))->object($field->addSrcDirectory($srcDirectory))->isIdenticalTo($field)->array($field->getSrcDirectories())->isEqualTo(array($srcDirectory => array()))->object($field->addSrcDirectory($otherSrcDirectory = rand(1, PHP_INT_MAX)))->isIdenticalTo($field)->array($field->getSrcDirectories())->isIdenticalTo(array($srcDirectory => array(), (string) $otherSrcDirectory => array()))->object($field->addSrcDirectory($srcDirectory, $closure = function () {
     }))->isIdenticalTo($field)->array($field->getSrcDirectories())->isIdenticalTo(array($srcDirectory => array($closure), (string) $otherSrcDirectory => array()))->object($field->addSrcDirectory($srcDirectory, $otherClosure = function () {
     }))->isIdenticalTo($field)->array($field->getSrcDirectories())->isIdenticalTo(array($srcDirectory => array($closure, $otherClosure), (string) $otherSrcDirectory => array()));
 }