public function testAll() { $this->mockGenerator->shuntParentClassCalls()->mockGenerator->orphanize('__construct')->given($probeMock = new \mock\Blackfire\Probe(), $clientMock = new \mock\Blackfire\Client())->mockGenerator->unshuntParentClassCalls()->given($this->calling($clientMock)->createProbe = $probeMock, $this->calling($clientMock)->endProbe = $this->getErrorProfile(), $config = new \Blackfire\Profile\Configuration()); $this->if($testedClass = new testedClass(), $testedClass->setConfiguration($config), $testedClass->setClient($clientMock))->then->exception(function () use($testedClass) { $testedClass->profile(function () { }); })->hasMessage($this->getExpectedErrorMessage())->isInstanceOf('\\mageekguy\\atoum\\asserter\\exception')->mock($clientMock)->call('createProbe')->once()->mock($clientMock)->call('endProbe')->once(); $this->given($test = new \mock\mageekguy\atoum\test(), $this->calling($clientMock)->endProbe = $this->getOkProfile())->if($testedClass = new testedClass(), $testedClass->setWithTest($test), $testedClass->setClient($clientMock), $testedClass->profile(function () { })); }
public function setTest(test $test) { $asserter = null; $configuration = $test->getExtensionConfiguration($this); if ($configuration !== null) { $this->configuration = $configuration; } $test->getAssertionManager()->setHandler('blackfire', function (Client $client = null) use($test, &$asserter) { if ($asserter === null) { $asserter = new atoum\blackfire\asserters\blackfire($test->getAsserterGenerator()); } if (null === $client) { $client = new Client($this->configuration->getClientConfiguration()); } $asserter->setClient($client); $asserter->setWithTest($test); return $asserter; }); return $this; }