Exemple #1
0
 public function testSetFilename()
 {
     $this->if($adapter = new atoum\test\adapter())->and($adapter->fopen = $resource = uniqid())->and($adapter->flock = true)->and($adapter->ftruncate = true)->and($adapter->fflush = function () {
     })->and($adapter->fclose = function () {
     })->and($file = new testedClass(null, $adapter))->then->object($file->setFilename($filename = uniqid()))->isIdenticalTo($file)->string($file->getFilename())->isEqualTo($filename)->then->object($file->setFilename())->isIdenticalTo($file)->string($file->getFilename())->isEqualTo(testedClass::defaultFileName)->if($adapter->fwrite = function ($resource, $data) {
         return strlen($data);
     })->and($obj = $file->write($string = uniqid()))->and($file->setFilename('anotherNameAgain'))->then->string($file->getFilename())->isEqualTo('anotherNameAgain')->adapter($adapter)->call('fclose')->withArguments($resource)->after($this->adapter($adapter)->call('flock')->withArguments($resource, LOCK_UN))->once();
 }
Exemple #2
0
 public function testGetFilename()
 {
     $this->if($file = new writers\file())->then->string($file->getFilename())->isEqualTo('atoum.log')->if($file->setFilename('anotherName'))->then->string($file->getFilename())->isEqualTo('anotherName');
 }