コード例 #1
0
ファイル: mock.php プロジェクト: andrewolobo/mpTracker
 public function testWasNotCalled()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->wasNotCalled();
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Mock is undefined')->if($adapter = new atoum\test\adapter())->and($adapter->class_exists = true)->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\mock($adapter)))->and($mock->getMockController()->resetCalls())->then->object($asserter->wasNotCalled())->isIdenticalTo($asserter)->if($mock->getMockController()->{$method = __FUNCTION__} = function () {
     })->and($mock->{$method}())->then->exception(function () use($asserter, &$failMessage) {
         $asserter->wasNotCalled($failMessage = uniqid());
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage($failMessage);
 }
コード例 #2
0
ファイル: mock.php プロジェクト: xihewang/atoum
 public function testSetWith()
 {
     $this->given($asserter = $this->newTestedInstance)->if($asserter->setLocale($locale = new \mock\atoum\locale())->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer()), $this->calling($locale)->_ = $notMock = uniqid(), $this->calling($analyzer)->getTypeOf = $type = uniqid())->then->exception(function () use($asserter, &$mock) {
         $asserter->setWith($mock = uniqid());
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage($notMock)->mock($locale)->call('_')->withArguments('%s is not a mock', $type)->once->mock($analyzer)->call('getTypeOf')->withArguments($mock)->once->object($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\mock()))->isIdenticalTo($asserter)->object($asserter->getAdapter())->isIdenticalTo($mock->getMockController());
 }