public function testGetDirectory() { $this->given($script = new mock\script($name = uniqid()))->and($script->setAdapter($adapter = new atoum\test\adapter()))->and($adapter->is_dir = true)->and($adapter->dirname = $directory = uniqid())->then->string($script->getDirectory())->isEqualTo($directory . DIRECTORY_SEPARATOR)->if($adapter->dirname = $directory . DIRECTORY_SEPARATOR)->then->string($script->getDirectory())->isEqualTo($directory . DIRECTORY_SEPARATOR)->if($adapter->is_dir = false)->and($adapter->getcwd = $currentDirectory = uniqid())->then->string($script->getDirectory())->isEqualTo($currentDirectory . DIRECTORY_SEPARATOR)->and($adapter->getcwd = $currentDirectory . DIRECTORY_SEPARATOR)->then->string($script->getDirectory())->isEqualTo($currentDirectory . DIRECTORY_SEPARATOR); }
public function testWriteLabels() { $this->if($stdOut = new mock\writers\std\out())->and($stdOut->getMockCOntroller()->write = function () { })->and($script = new mock\script(uniqid()))->and($script->setOutputWriter($stdOut))->then->object($script->writeLabels(array($label = uniqid() => $message = uniqid())))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments(atoum\script::padding . $label . ': ' . $message . PHP_EOL)->once()->object($script->writeLabels(array($label1 = uniqid() => $message1 = uniqid(), $label2 = uniqid() => $message2 = uniqid(), $label3 = uniqid() => $message3 = uniqid())))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments(atoum\script::padding . $label1 . ': ' . $message1 . PHP_EOL)->once()->call('write')->withIdenticalArguments(atoum\script::padding . $label2 . ': ' . $message2 . PHP_EOL)->once()->call('write')->withIdenticalArguments(atoum\script::padding . $label3 . ': ' . $message3 . PHP_EOL)->once()->object($script->writeLabels(array($label1 = uniqid() => $message1 = uniqid(), $label2 = ' ' . uniqid() => $message2 = uniqid(), $label3 = uniqid() => $message3 = uniqid())))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments(atoum\script::padding . ' ' . $label1 . ': ' . $message1 . PHP_EOL)->once()->call('write')->withIdenticalArguments(atoum\script::padding . $label2 . ': ' . $message2 . PHP_EOL)->once()->call('write')->withIdenticalArguments(atoum\script::padding . ' ' . $label3 . ': ' . $message3 . PHP_EOL)->once()->object($script->writeLabels(array($label1 = uniqid() => $message1 = uniqid(), $label2 = 'xx' . uniqid() => $message2 = uniqid(), $label3 = uniqid() => $message3 = uniqid()), 3))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments(atoum\script::padding . atoum\script::padding . atoum\script::padding . ' ' . $label1 . ': ' . $message1 . PHP_EOL)->once()->call('write')->withIdenticalArguments(atoum\script::padding . atoum\script::padding . atoum\script::padding . $label2 . ': ' . $message2 . PHP_EOL)->once()->call('write')->withIdenticalArguments(atoum\script::padding . atoum\script::padding . atoum\script::padding . ' ' . $label3 . ': ' . $message3 . PHP_EOL)->once()->object($script->writeLabels(array($label1 = uniqid() => $message1 = uniqid(), $label2 = 'xx' . uniqid() => ($message21 = uniqid()) . PHP_EOL . ($message22 = uniqid()), $label3 = uniqid() => $message3 = uniqid()), 3))->isIdenticalTo($script)->mock($stdOut)->call('write')->withIdenticalArguments(atoum\script::padding . atoum\script::padding . atoum\script::padding . ' ' . $label1 . ': ' . $message1 . PHP_EOL)->once()->call('write')->withIdenticalArguments(atoum\script::padding . atoum\script::padding . atoum\script::padding . $label2 . ': ' . $message21 . PHP_EOL)->once()->call('write')->withIdenticalArguments(atoum\script::padding . atoum\script::padding . atoum\script::padding . ' ' . ': ' . $message22 . PHP_EOL)->once()->call('write')->withIdenticalArguments(atoum\script::padding . atoum\script::padding . atoum\script::padding . ' ' . $label3 . ': ' . $message3 . PHP_EOL)->once(); }