示例#1
0
文件: html.php 项目: xihewang/atoum
 public function testCleanDestinationDirectory()
 {
     $this->if($destinationDirectory = stream::get())->and($destinationDirectory->opendir = true)->and($destinationDirectory->readdir[1] = $directory = stream::getSubStream($destinationDirectory))->and($directory->opendir = true)->and($directory->readdir[1] = $firstFile = stream::getSubStream($directory))->and($firstFile->unlink = true)->and($directory->readdir[2] = $secondFile = stream::getSubStream($directory))->and($secondFile->unlink = true)->and($directory->readdir[3] = false)->and($destinationDirectory->readdir[2] = $emptyDirectory = stream::getSubStream($destinationDirectory))->and($emptyDirectory->opendir = true)->and($emptyDirectory->readdir[1] = false)->and($destinationDirectory->readdir[3] = $otherDirectory = stream::getSubStream($destinationDirectory))->and($otherDirectory->opendir = true)->and($otherDirectory->readdir[1] = $otherFirstFile = stream::getSubStream($otherDirectory))->and($otherFirstFile->unlink = true)->and($otherDirectory->readdir[2] = $otherSecondFile = stream::getSubStream($otherDirectory))->and($otherSecondFile->unlink = true)->and($otherDirectory->readdir[3] = false)->and($destinationDirectory->readdir[4] = $file = stream::getSubStream($destinationDirectory))->and($file->unlink = true)->and($destinationDirectory->readdir[5] = false)->and($field = new \mock\mageekguy\atoum\report\fields\runner\coverage\html(uniqid(), (string) $destinationDirectory))->and($field->setAdapter($adapter = new test\adapter()))->and($adapter->rmdir = function () {
     })->and($adapter->unlink = function () {
     })->then->object($field->cleanDestinationDirectory())->isIdenticalTo($field)->adapter($adapter)->call('unlink')->withArguments((string) $firstFile)->once()->call('unlink')->withArguments((string) $secondFile)->once()->call('rmdir')->withArguments((string) $directory)->once()->call('unlink')->withArguments((string) $otherFirstFile)->once()->call('unlink')->withArguments((string) $otherSecondFile)->once()->call('rmdir')->withArguments((string) $otherDirectory)->once()->call('unlink')->withArguments((string) $file)->once()->call('rmdir')->withArguments((string) $emptyDirectory)->once()->call('rmdir')->withArguments((string) $destinationDirectory)->never()->if($field->getMockController()->getDestinationDirectoryIterator->throw = new \exception())->then->object($field->cleanDestinationDirectory())->isIdenticalTo($field);
 }