public function testWriteAsynchronousReport() { $this->if($mailer = new atoum\mailers\mail())->and($writer = new \mock\mageekguy\atoum\writers\mail($mailer, $locale = new \mock\mageekguy\atoum\locale(), $adapter = new atoum\test\adapter()))->and($writer->getMockController()->write = $writer)->and($adapter->date = function ($arg) { return $arg; })->then->object($writer->writeAsynchronousReport($report = new \mock\mageekguy\atoum\reports\asynchronous()))->isIdenticalTo($writer)->mock($writer)->call('write')->withArguments((string) $report)->once()->string($mailer->getSubject())->isEqualTo('Unit tests report, the Y-m-d at H:i:s')->mock($locale)->call('_')->withArguments('Unit tests report, the %1$s at %2$s')->once()->call('_')->withArguments('Y-m-d')->once()->call('_')->withArguments('H:i:s')->once()->if($mailer = new atoum\mailers\mail())->and($writer = new \mock\mageekguy\atoum\writers\mail($mailer, $locale = new \mock\mageekguy\atoum\locale(), $adapter = new atoum\test\adapter()))->and($writer->getMockController()->write = $writer)->then->object($writer->writeAsynchronousReport($report->setTitle($title = uniqid())))->isIdenticalTo($writer)->mock($writer)->call('write')->withArguments((string) $report)->once()->string($mailer->getSubject())->isEqualTo($title)->mock($locale)->call('_')->never()->if($mailer->setSubject($mailerSubject = uniqid()))->and(atoum\test\adapter::resetCallsForAllInstances())->then->object($writer->writeAsynchronousReport($report))->isIdenticalTo($writer)->mock($writer)->call('write')->withArguments((string) $report)->once()->string($mailer->getSubject())->isEqualTo($mailerSubject); }
public function stopCase() { test\adapter::resetCallsForAllInstances(); $this->score->unsetCase(); return $this; }