public function testRun()
 {
     $this->if($adapter = new atoum\test\adapter())->and($adapter->file_get_contents = false)->and($adapter->fopen = $runFileResource = uniqid())->and($adapter->flock = true)->and($adapter->getmypid = $pid = uniqid())->and($adapter->fwrite = function () {
     })->and($adapter->fclose = function () {
     })->and($adapter->unlink = function () {
     })->and($builder = new \mock\mageekguy\atoum\scripts\builder(uniqid(), $adapter))->and($builder->setRunFile($runFile = uniqid()))->and($this->calling($builder)->createPhar = function () {
     })->then->object($builder->run())->isIdenticalTo($builder)->mock($builder)->call('createPhar')->once()->adapter($adapter)->call('file_get_contents')->withArguments($runFile)->once()->call('fopen')->withArguments($runFile, 'w+')->once()->call('flock')->withArguments($runFileResource, \LOCK_EX | \LOCK_NB)->once()->call('fwrite')->withArguments($runFileResource, $pid)->once()->call('fclose')->withArguments($runFileResource)->once()->call('unlink')->withArguments($runFile)->once();
 }
Example #2
0
 public function testLockPosix()
 {
     $this->if($adapterPosix = new \mock\mageekguy\atoum\test\adapter())->and($adapterPosix->file_get_contents = '1')->and($adapterPosix->function_exists = true)->and($adapterPosix->posix_kill = false)->and($builder = new \mock\mageekguy\atoum\scripts\builder(uniqid(), $adapterPosix))->and($builder->setRunFile($runFile = uniqid()))->and($this->calling($builder)->createPhar = function () {
     })->and($this->calling($builder)->createPhar = function () {
     })->then->object($builder->run())->isIdenticalTo($builder)->mock($builder)->call('createPhar')->once()->mock($adapterPosix)->call('posix_kill')->once();
 }