How to use getCall method of call class

Best Atoum code snippet using call.getCall

mock.php

Source:mock.php Github

copy

Full Screen

...27 ->then28 ->object($asserter->getLocale())->isIdenticalTo($generator->getLocale())29 ->object($asserter->getGenerator())->isIdenticalTo($generator)30 ->variable($asserter->getMock())->isNull()31 ->variable($asserter->getCall())->isNull()32 ->array($asserter->getBeforeMethodCalls())->isEmpty()33 ->array($asserter->getAfterMethodCalls())->isEmpty()34 ;35 }36 public function testReset()37 {38 $this39 ->if($mockController = new \mock\mageekguy\atoum\mock\controller())40 ->and($asserter = new asserters\mock($generator = new asserter\generator()))41 ->then42 ->variable($asserter->getMock())->isNull()43 ->object($asserter->reset())->isIdenticalTo($asserter)44 ->variable($asserter->getMock())->isNull()45 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\score()))46 ->and($mock->setMockController($mockController))47 ->then48 ->object($asserter->getMock())->isIdenticalTo($mock)49 ->object($asserter->reset())->isIdenticalTo($asserter)50 ->object($asserter->getMock())->isIdenticalTo($mock)51 ->mock($mockController)->call('resetCalls')->once();52 }53 public function testSetWith()54 {55 $this56 ->if($asserter = new asserters\mock($generator = new asserter\generator()))57 ->and($adapter = new atoum\test\adapter())58 ->and($adapter->class_exists = true)59 ->then60 ->exception(function() use ($asserter, & $mock) { $asserter->setWith($mock = uniqid()); })61 ->isInstanceOf('mageekguy\atoum\asserter\exception')62 ->hasMessage(sprintf($generator->getLocale()->_('%s is not a mock'), $asserter->getTypeOf($mock)))63 ->object($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\mock($adapter)))->isIdenticalTo($asserter)64 ->object($asserter->getMock())->isIdenticalTo($mock)65 ;66 }67 public function testWasCalled()68 {69 $this70 ->if($asserter = new asserters\mock($generator = new asserter\generator()))71 ->then72 ->exception(function() use ($asserter) { $asserter->wasCalled(); })73 ->isInstanceOf('mageekguy\atoum\exceptions\logic')74 ->hasMessage('Mock is undefined')75 ->if($adapter = new atoum\test\adapter())76 ->and($adapter->class_exists = true)77 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\mock($adapter)))78 ->and($mock->getMockController()->resetCalls())79 ->then80 ->exception(function() use ($asserter) { $asserter->wasCalled(); })81 ->isInstanceOf('mageekguy\atoum\asserter\exception')82 ->hasMessage(sprintf($generator->getLocale()->_('%s is not called'), get_class($mock)))83 ->exception(function() use ($asserter, & $failMessage) { $asserter->wasCalled($failMessage = uniqid()); })84 ->isInstanceOf('mageekguy\atoum\asserter\exception')85 ->hasMessage($failMessage)86 ->if($mock->getMockController()->{$method = __FUNCTION__} = function() {})87 ->and($mock->{$method}())88 ->then89 ->object($asserter->wasCalled())->isIdenticalTo($asserter)90 ;91 }92 public function testWasNotCalled()93 {94 $this95 ->if($asserter = new asserters\mock($generator = new asserter\generator()))96 ->then97 ->exception(function() use ($asserter) { $asserter->wasNotCalled(); })98 ->isInstanceOf('mageekguy\atoum\exceptions\logic')99 ->hasMessage('Mock is undefined')100 ->if($adapter = new atoum\test\adapter())101 ->and($adapter->class_exists = true)102 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\mock($adapter)))103 ->and($mock->getMockController()->resetCalls())104 ->then105 ->object($asserter->wasNotCalled())->isIdenticalTo($asserter)106 ->if($mock->getMockController()->{$method = __FUNCTION__} = function() {})107 ->and($mock->{$method}())108 ->then109 ->exception(function() use ($asserter, & $failMessage) { $asserter->wasNotCalled($failMessage = uniqid()); })110 ->isInstanceOf('mageekguy\atoum\asserter\exception')111 ->hasMessage($failMessage)112 ;113 }114 public function testBeforeMethodCall()115 {116 $this117 ->if($asserter = new asserters\mock($generator = new asserter\generator()))118 ->then119 ->exception(function() use ($asserter) { $asserter->beforeMethodCall(uniqid()); })120 ->isInstanceOf('mageekguy\atoum\exceptions\logic')121 ->hasMessage('Mock is undefined')122 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))123 ->then124 ->object($asserter->beforeMethodCall('foo'))->isEqualTo($beforeMethodCall = new asserters\mock\call\mock($asserter, $mock, 'foo'))125 ->array($asserter->getBeforeMethodCalls())->isEqualTo(array($beforeMethodCall))126 ->object($asserter->beforeMethodCall('bar'))->isEqualTo($otherBeforeMethodCall = new asserters\mock\call\mock($asserter, $mock, 'bar'))127 ->array($asserter->getBeforeMethodCalls())->isEqualTo(array($beforeMethodCall, $otherBeforeMethodCall))128 ;129 }130 public function testWithAnyMethodCallsBefore()131 {132 $this133 ->if($asserter = new asserters\mock($generator = new asserter\generator()))134 ->then135 ->array($asserter->getBeforeMethodCalls())->isEmpty()136 ->object($asserter->withAnyMethodCallsBefore())->isIdenticalTo($asserter)137 ->array($asserter->getBeforeMethodCalls())->isEmpty()138 ->if($asserter->setWith(new \mock\mageekguy\atoum\tests\units\asserters\dummy()))139 ->and($asserter->beforeMethodCall(uniqid()))140 ->then141 ->array($asserter->getBeforeMethodCalls())->isNotEmpty()142 ->object($asserter->withAnyMethodCallsBefore())->isIdenticalTo($asserter)143 ->array($asserter->getBeforeMethodCalls())->isEmpty()144 ->if($asserter145 ->beforeMethodCall(uniqid())146 ->beforeMethodCall(uniqid())147 )148 ->then149 ->array($asserter->getBeforeMethodCalls())->isNotEmpty()150 ->object($asserter->withAnyMethodCallsBefore())->isIdenticalTo($asserter)151 ->array($asserter->getBeforeMethodCalls())->isEmpty()152 ;153 }154 public function testAfterMethodCall()155 {156 $this157 ->if($asserter = new asserters\mock($generator = new asserter\generator()))158 ->then159 ->exception(function() use ($asserter) { $asserter->afterMethodCall(uniqid()); })160 ->isInstanceOf('mageekguy\atoum\exceptions\logic')161 ->hasMessage('Mock is undefined')162 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))163 ->then164 ->object($asserter->afterMethodCall('foo'))->isEqualTo($afterMethodCall = new asserters\mock\call\mock($asserter, $mock, 'foo'))165 ->array($asserter->getAfterMethodCalls())->isEqualTo(array($afterMethodCall))166 ->object($asserter->afterMethodCall('bar'))->isEqualTo($otherAfterMethodCall = new asserters\mock\call\mock($asserter, $mock, 'bar'))167 ->array($asserter->getAfterMethodCalls())->isEqualTo(array($afterMethodCall, $otherAfterMethodCall))168 ;169 }170 public function testWithAnyMethodCallsAfter()171 {172 $this173 ->if($asserter = new asserters\mock($generator = new asserter\generator()))174 ->then175 ->array($asserter->getAfterMethodCalls())->isEmpty()176 ->object($asserter->withAnyMethodCallsAfter())->isIdenticalTo($asserter)177 ->array($asserter->getAfterMethodCalls())->isEmpty()178 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))179 ->and($asserter->afterMethodCall($function = uniqid()))180 ->then181 ->array($asserter->getAfterMethodCalls())->isNotEmpty()182 ->object($asserter->withAnyMethodCallsAfter())->isIdenticalTo($asserter)183 ->array($asserter->getAfterMethodCalls())->isEmpty()184 ->if($asserter185 ->afterMethodCall($function1 = uniqid())186 ->afterMethodCall($function2 = uniqid())187 )188 ->then189 ->array($asserter->getAfterMethodCalls())->isNotEmpty()190 ->object($asserter->withAnyMethodCallsAfter())->isIdenticalTo($asserter)191 ->array($asserter->getAfterMethodCalls())->isEmpty()192 ;193 }194 public function testBeforeFunctionCall()195 {196 $this197 ->if($asserter = new asserters\mock($generator = new asserter\generator()))198 ->then199 ->exception(function() use ($asserter) { $asserter->beforeFunctionCall(uniqid(), new test\adapter()); })200 ->isInstanceOf('mageekguy\atoum\exceptions\logic')201 ->hasMessage('Mock is undefined')202 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))203 ->and($adapter = new test\adapter())204 ->then205 ->object($asserter->beforeFunctionCall('foo', $adapter))->isEqualTo($beforeFunctionCall = new asserters\mock\call\adapter($asserter, $adapter, 'foo'))206 ->array($asserter->getBeforeFunctionCalls())->isEqualTo(array($beforeFunctionCall))207 ->object($asserter->beforeFunctionCall('bar', $adapter))->isEqualTo($otherBeforeFunctionCall = new asserters\mock\call\adapter($asserter, $adapter, 'bar'))208 ->array($asserter->getBeforeFunctionCalls())->isEqualTo(array($beforeFunctionCall, $otherBeforeFunctionCall))209 ;210 }211 public function testWithAnyFunctionCallsBefore()212 {213 $this214 ->if($asserter = new asserters\mock($generator = new asserter\generator()))215 ->then216 ->array($asserter->getBeforeFunctionCalls())->isEmpty()217 ->object($asserter->withAnyFunctionCallsBefore())->isIdenticalTo($asserter)218 ->array($asserter->getBeforeFunctionCalls())->isEmpty()219 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))220 ->and($adapter = new test\adapter())221 ->and($asserter->beforeFunctionCall($function = uniqid(), $adapter))222 ->then223 ->array($asserter->getBeforeFunctionCalls())->isNotEmpty()224 ->object($asserter->withAnyFunctionCallsBefore())->isIdenticalTo($asserter)225 ->array($asserter->getBeforeFunctionCalls())->isEmpty()226 ->if($asserter227 ->beforeFunctionCall($function1 = uniqid(), $adapter)228 ->beforeFunctionCall($function2 = uniqid(), $adapter)229 )230 ->then231 ->array($asserter->getBeforeFunctionCalls())->isNotEmpty()232 ->object($asserter->withAnyFunctionCallsBefore())->isIdenticalTo($asserter)233 ->array($asserter->getBeforeFunctionCalls())->isEmpty()234 ;235 }236 public function testAfterFunctionCall()237 {238 $this239 ->if($asserter = new asserters\mock($generator = new asserter\generator()))240 ->then241 ->exception(function() use ($asserter) { $asserter->afterFunctionCall(uniqid(), new test\adapter()); })242 ->isInstanceOf('mageekguy\atoum\exceptions\logic')243 ->hasMessage('Mock is undefined')244 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))245 ->and($adapter = new test\adapter())246 ->then247 ->object($asserter->afterFunctionCall('foo', $adapter))->isEqualTo($afterFunctionCall = new asserters\mock\call\adapter($asserter, $adapter, 'foo'))248 ->array($asserter->getAfterFunctionCalls())->isEqualTo(array($afterFunctionCall))249 ->object($asserter->afterFunctionCall('bar', $adapter))->isEqualTo($otherAfterFunctionCall = new asserters\mock\call\adapter($asserter, $adapter, 'bar'))250 ->array($asserter->getAfterFunctionCalls())->isEqualTo(array($afterFunctionCall, $otherAfterFunctionCall))251 ;252 }253 public function testWithAnyFunctionCallsAfter()254 {255 $this256 ->if($asserter = new asserters\mock($generator = new asserter\generator()))257 ->then258 ->array($asserter->getAfterFunctionCalls())->isEmpty()259 ->object($asserter->withAnyFunctionCallsAfter())->isIdenticalTo($asserter)260 ->array($asserter->getAfterFunctionCalls())->isEmpty()261 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))262 ->and($adapter = new test\adapter())263 ->and($asserter->afterFunctionCall($function = uniqid(), $adapter))264 ->then265 ->array($asserter->getAfterFunctionCalls())->isNotEmpty()266 ->object($asserter->withAnyFunctionCallsAfter())->isIdenticalTo($asserter)267 ->array($asserter->getAfterFunctionCalls())->isEmpty()268 ->if($asserter269 ->afterFunctionCall($function1 = uniqid(), $adapter)270 ->afterFunctionCall($function2 = uniqid(), $adapter)271 )272 ->then273 ->array($asserter->getAfterFunctionCalls())->isNotEmpty()274 ->object($asserter->withAnyFunctionCallsAfter())->isIdenticalTo($asserter)275 ->array($asserter->getAfterFunctionCalls())->isEmpty()276 ;277 }278 public function testCall()279 {280 $this281 ->if($asserter = new \mock\mageekguy\atoum\asserters\mock(new asserter\generator()))282 ->then283 ->exception(function() use ($asserter) { $asserter->call(uniqid()); })284 ->isInstanceOf('mageekguy\atoum\exceptions\logic')285 ->hasMessage('Mock is undefined')286 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))287 ->then288 ->object($asserter->call($function = uniqid()))->isIdenticalTo($asserter)289 ->object($asserter->getCall())->isEqualTo(new php\call($function, null, $mock))290 ->if($asserter->withArguments())291 ->then292 ->object($asserter->getCall())->isEqualTo(new php\call($function, array(), $mock))293 ->object($asserter->call($function = uniqid()))->isIdenticalTo($asserter)294 ->object($asserter->getCall())->isEqualTo(new php\call($function, null, $mock))295 ;296 }297 public function testWithArguments()298 {299 $this300 ->if($asserter = new \mock\mageekguy\atoum\asserters\mock(new asserter\generator()))301 ->then302 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })303 ->isInstanceOf('mageekguy\atoum\exceptions\logic')304 ->hasMessage('Mock is undefined')305 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))306 ->then307 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })308 ->isInstanceOf('mageekguy\atoum\exceptions\logic')309 ->hasMessage('Called method is undefined')310 ->if($asserter->call($function = uniqid()))311 ->then312 ->object($asserter->withArguments())->isIdenticalTo($asserter)313 ->object($asserter->getCall())->isEqualTo(new php\call($function, array(), $mock))314 ->object($asserter->withArguments($arg1 = uniqid()))->isIdenticalTo($asserter)315 ->object($asserter->getCall())->isEqualTo(new php\call($function, array($arg1), $mock))316 ->object($asserter->withArguments($arg1 = uniqid(), $arg2 = uniqid()))->isIdenticalTo($asserter)317 ->object($asserter->getCall())->isEqualTo(new php\call($function, array($arg1, $arg2), $mock))318 ;319 }320 public function testWithAtLeastArguments()321 {322 $this323 ->if($asserter = new \mock\mageekguy\atoum\asserters\mock(new asserter\generator()))324 ->then325 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })326 ->isInstanceOf('mageekguy\atoum\exceptions\logic')327 ->hasMessage('Mock is undefined')328 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))329 ->then330 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })331 ->isInstanceOf('mageekguy\atoum\exceptions\logic')332 ->hasMessage('Called method is undefined')333 ->if($asserter->call($function = uniqid()))334 ->then335 ->object($asserter->withAtLeastArguments($arguments = array(1 => uniqid())))->isIdenticalTo($asserter)336 ->object($asserter->getCall())->isEqualTo(new php\call($function, $arguments, $mock))337 ->object($asserter->withAtLeastArguments($arguments = array(2 => uniqid(), 5 => uniqid())))->isIdenticalTo($asserter)338 ->object($asserter->getCall())->isEqualTo(new php\call($function, $arguments, $mock))339 ;340 }341 public function testWithAnyArguments()342 {343 $this344 ->if($asserter = new \mock\mageekguy\atoum\asserters\mock(new asserter\generator()))345 ->then346 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })347 ->isInstanceOf('mageekguy\atoum\exceptions\logic')348 ->hasMessage('Mock is undefined')349 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))350 ->then351 ->exception(function() use ($asserter) { $asserter->withArguments(uniqid()); })352 ->isInstanceOf('mageekguy\atoum\exceptions\logic')353 ->hasMessage('Called method is undefined')354 ->if($asserter->call($function = uniqid()))355 ->then356 ->object($asserter->getCall())->isEqualTo(new php\call($function, null, $mock))357 ->object($asserter->withAnyArguments())->isIdenticalTo($asserter)358 ->object($asserter->getCall())->isEqualTo(new php\call($function, null, $mock))359 ->if($asserter->withArguments($arg = uniqid()))360 ->then361 ->object($asserter->getCall())->isEqualTo(new php\call($function, array($arg), $mock))362 ->object($asserter->withAnyArguments())->isIdenticalTo($asserter)363 ->object($asserter->getCall())->isEqualTo(new php\call($function, null, $mock))364 ;365 }366 public function testOnce()367 {368 $this369 ->if($asserter = new asserters\mock($generator = new asserter\generator()))370 ->then371 ->exception(function() use ($asserter) { $asserter->once(); })372 ->isInstanceOf('mageekguy\atoum\exceptions\logic')373 ->hasMessage('Mock is undefined')374 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))375 ->then376 ->exception(function() use ($asserter) { $asserter->once(); })377 ->isInstanceOf('mageekguy\atoum\exceptions\logic')378 ->hasMessage('Called method is undefined')379 ->if($asserter->call('foo'))380 ->then381 ->exception(function() use ($asserter) { $asserter->once(); })382 ->isInstanceOf('mageekguy\atoum\asserter\exception')383 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 1'), $asserter->getCall()))384 ->if($call = new php\call('foo', null, $mock))385 ->and($mock->foo($usedArg = uniqid()))386 ->then387 ->object($asserter->once())->isIdenticalTo($asserter)388 ->if($mock->foo($otherUsedArg = uniqid()))389 ->then390 ->exception(function() use ($asserter) { $asserter->once(); })391 ->isInstanceOf('mageekguy\atoum\asserter\exception')392 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 2 times instead of 1'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($otherUsedArg)))393 ->if($mock->getMockController()->resetCalls())394 ->and($asserter->withArguments($usedArg = uniqid()))395 ->and($mock->foo($usedArg))396 ->then397 ->object($asserter->once())->isIdenticalTo($asserter)398 ->if($asserter->withArguments($arg = uniqid()))399 ->then400 ->exception(function() use ($asserter) { $asserter->once(); })401 ->isInstanceOf('mageekguy\atoum\asserter\exception')402 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 1'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))403 ->if($asserter = new asserters\mock($generator = new asserter\generator()))404 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))405 ->and($asserter->beforeMethodCall('bar')->call('foo'))406 ->then407 ->exception(function() use ($asserter) { $asserter->once(); })408 ->isInstanceOf('mageekguy\atoum\asserter\exception')409 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 1'), $asserter->getCall()))410 ->if($mock->foo(uniqid()))411 ->object($asserter->once())->isIdenticalTo($asserter)412 /*413 ->if($mock->getMockController()->resetCalls())414 ->and($mock->bar(uniqid()))415 ->and($mock->foo(uniqid()))416 ->then417 ->exception(function() use ($asserter) { $asserter->once(); })418 ->isInstanceOf('mageekguy\atoum\asserter\exception')419 ->hasMessage(sprintf($generator->getLocale()->_('method %s is not called before method %s'), $asserter->getCall(), current($asserter->getBeforeMethodCalls())))420 */421 ->if($mock->getMockController()->resetCalls())422 ->and($mock->foo(uniqid()))423 ->and($mock->bar(uniqid()))424 ->then425 ->object($asserter->once())->isIdenticalTo($asserter)426 ->if($asserter = new asserters\mock($generator = new asserter\generator()))427 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))428 ->and($asserter->afterMethodCall('bar')->call('foo'))429 ->then430 ->exception(function() use ($asserter) { $asserter->once(); })431 ->isInstanceOf('mageekguy\atoum\asserter\exception')432 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 1'), $asserter->getCall()))433 /*434 ->if($mock->foo(uniqid()))435 ->then436 ->exception(function() use ($asserter) { $asserter->once(); })437 ->isInstanceOf('mageekguy\atoum\asserter\exception')438 ->hasMessage(sprintf($generator->getLocale()->_('method %s is not called'), current($asserter->getAfterMethodCalls())))439 ->if($mock->getMockController()->resetCalls())440 ->and($mock->foo(uniqid()))441 ->and($mock->bar(uniqid()))442 ->then443 ->exception(function() use ($asserter) { $asserter->once(); })444 ->isInstanceOf('mageekguy\atoum\asserter\exception')445 ->hasMessage(sprintf($generator->getLocale()->_('method %s is not called after method %s'), $asserter->getCall(), current($asserter->getAfterMethodCalls())))446 */447 ->if($mock->getMockController()->resetCalls())448 ->and($mock->bar(uniqid()))449 ->and($mock->foo(uniqid()))450 ->then451 ->object($asserter->once())->isIdenticalTo($asserter)452 ->if($asserter = new asserters\mock($generator = new asserter\generator()))453 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))454 ->and($asserter->beforeMethodCall('bar')->withArguments($arg = 'toto')->call('foo'))455 ->and($mock->foo(uniqid()))456 ->then457 ->exception(function() use ($asserter) { $asserter->once(); })458 ->isInstanceOf('mageekguy\atoum\asserter\exception')459 ->hasMessage(sprintf($generator->getLocale()->_('method %s is not called'), current($asserter->getBeforeMethodCalls())))460 ;461 }462 public function testTwice()463 {464 $this465 ->if($asserter = new asserters\mock($generator = new asserter\generator()))466 ->then467 ->exception(function() use ($asserter) { $asserter->twice(); })468 ->isInstanceOf('mageekguy\atoum\exceptions\logic')469 ->hasMessage('Mock is undefined')470 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))471 ->then472 ->exception(function() use ($asserter) { $asserter->twice(); })473 ->isInstanceOf('mageekguy\atoum\exceptions\logic')474 ->hasMessage('Called method is undefined')475 ->if($asserter->call('foo'))476 ->then477 ->exception(function() use ($asserter) { $asserter->twice(); })478 ->isInstanceOf('mageekguy\atoum\asserter\exception')479 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 2'), $asserter->getCall()))480 ->if($call = new php\call('foo', null, $mock))481 ->and($mock->foo($usedArg = uniqid()))482 ->then483 ->exception(function() use ($asserter) { $asserter->twice(); })484 ->isInstanceOf('mageekguy\atoum\asserter\exception')485 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))486 ->if($mock->foo($secondArg = uniqid()))487 ->then488 ->object($asserter->twice())->isIdenticalTo($asserter)489 ->if($mock->foo($thirdArg = uniqid()))490 ->then491 ->exception(function() use ($asserter) { $asserter->twice(); })492 ->isInstanceOf('mageekguy\atoum\asserter\exception')493 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 3 times instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($secondArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($thirdArg)))494 ->if($mock->getMockController()->resetCalls())495 ->and($asserter->withArguments($usedArg = uniqid()))496 ->then497 ->exception(function() use ($asserter) { $asserter->twice(); })498 ->isInstanceOf('mageekguy\atoum\asserter\exception')499 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 2'), $asserter->getCall()))500 ->if($mock->foo($usedArg))501 ->then502 ->exception(function() use ($asserter) { $asserter->twice(); })503 ->isInstanceOf('mageekguy\atoum\asserter\exception')504 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))505 ->if($mock->foo($usedArg))506 ->then507 ->object($asserter->twice())->isIdenticalTo($asserter)508 ->if($mock->foo($usedArg))509 ->then510 ->exception(function() use ($asserter) { $asserter->twice(); })511 ->isInstanceOf('mageekguy\atoum\asserter\exception')512 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 3 times instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($usedArg)))513 ->if($asserter->withArguments($arg = uniqid()))514 ->then515 ->exception(function() use ($asserter) { $asserter->twice(); })516 ->isInstanceOf('mageekguy\atoum\asserter\exception')517 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($usedArg)))518 ->if($asserter = new asserters\mock($generator = new asserter\generator()))519 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))520 ->and($asserter->beforeMethodCall('bar')->call('foo'))521 ->then522 ->exception(function() use ($asserter) { $asserter->twice(); })523 ->isInstanceOf('mageekguy\atoum\asserter\exception')524 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 2'), $asserter->getCall()))525 ->if($mock->foo($usedArg = uniqid()))526 ->exception(function() use ($asserter) { $asserter->twice(); })527 ->isInstanceOf('mageekguy\atoum\asserter\exception')528 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))529 ->if($mock->foo(uniqid()))530 ->object($asserter->twice())->isIdenticalTo($asserter)531 ->if($mock->getMockController()->resetCalls())532 ->and($mock->foo($usedArg = uniqid()))533 ->and($mock->bar(uniqid()))534 ->then535 ->exception(function() use ($asserter) { $asserter->twice(); })536 ->isInstanceOf('mageekguy\atoum\asserter\exception')537 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))538 ->if($mock->foo($usedArg = uniqid()))539 ->and($mock->bar(uniqid()))540 ->then541 ->object($asserter->twice())->isIdenticalTo($asserter)542 ->if($asserter = new asserters\mock($generator = new asserter\generator()))543 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))544 ->and($asserter->afterMethodCall('bar')->call('foo'))545 ->then546 ->exception(function() use ($asserter) { $asserter->twice(); })547 ->isInstanceOf('mageekguy\atoum\asserter\exception')548 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 2'), $asserter->getCall()))549 ->if($mock->getMockController()->resetCalls())550 ->and($mock->bar(uniqid()))551 ->and($mock->foo($usedArg = uniqid()))552 ->then553 ->exception(function() use ($asserter) { $asserter->twice(); })554 ->isInstanceOf('mageekguy\atoum\asserter\exception')555 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))556 ->if($mock->foo(uniqid()))557 ->then558 ->object($asserter->twice())->isIdenticalTo($asserter)559 ->if($asserter = new asserters\mock($generator = new asserter\generator()))560 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))561 ->and($asserter->beforeMethodCall('bar')->withArguments($arg = 'toto')->call('foo'))562 ->and($mock->foo(uniqid()))563 ->then564 ->exception(function() use ($asserter) { $asserter->twice(); })565 ->isInstanceOf('mageekguy\atoum\asserter\exception')566 ->hasMessage(sprintf($generator->getLocale()->_('method %s is not called'), current($asserter->getBeforeMethodCalls())))567 ->and($mock->foo(uniqid()))568 ->if($mock->bar($arg))569 ->then570 ->object($asserter->twice())->isIdenticalTo($asserter)571 ;572 }573 public function testThrice()574 {575 $this576 ->if($asserter = new asserters\mock($generator = new asserter\generator()))577 ->then578 ->exception(function() use ($asserter) { $asserter->thrice(); })579 ->isInstanceOf('mageekguy\atoum\exceptions\logic')580 ->hasMessage('Mock is undefined')581 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))582 ->then583 ->exception(function() use ($asserter) { $asserter->thrice(); })584 ->isInstanceOf('mageekguy\atoum\exceptions\logic')585 ->hasMessage('Called method is undefined')586 ->if($asserter->call('foo'))587 ->then588 ->exception(function() use ($asserter) { $asserter->thrice(); })589 ->isInstanceOf('mageekguy\atoum\asserter\exception')590 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 3'), $asserter->getCall()))591 ->if($call = new php\call('foo', null, $mock))592 ->and($mock->foo($usedArg = uniqid()))593 ->then594 ->exception(function() use ($asserter) { $asserter->thrice(); })595 ->isInstanceOf('mageekguy\atoum\asserter\exception')596 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))597 ->if($mock->foo($secondArg = uniqid()))598 ->then599 ->exception(function() use ($asserter) { $asserter->thrice(); })600 ->isInstanceOf('mageekguy\atoum\asserter\exception')601 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 2 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($secondArg)))602 ->if($mock->foo($thirdArg = uniqid()))603 ->then604 ->object($asserter->thrice())->isIdenticalTo($asserter)605 ->if($mock->foo($fourthArg = uniqid()))606 ->then607 ->exception(function() use ($asserter) { $asserter->thrice(); })608 ->isInstanceOf('mageekguy\atoum\asserter\exception')609 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 4 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($secondArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($thirdArg)) . PHP_EOL . '[4] ' . $call->setArguments(array($fourthArg)))610 ->if($mock->getMockController()->resetCalls())611 ->and($asserter->withArguments($usedArg = uniqid()))612 ->then613 ->exception(function() use ($asserter) { $asserter->thrice(); })614 ->isInstanceOf('mageekguy\atoum\asserter\exception')615 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 3'), $asserter->getCall()))616 ->if($mock->foo($usedArg))617 ->then618 ->exception(function() use ($asserter) { $asserter->thrice(); })619 ->isInstanceOf('mageekguy\atoum\asserter\exception')620 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))621 ->if($mock->foo($usedArg))622 ->then623 ->exception(function() use ($asserter) { $asserter->thrice(); })624 ->isInstanceOf('mageekguy\atoum\asserter\exception')625 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 2 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)))626 ->if($mock->foo($usedArg))627 ->then628 ->object($asserter->thrice())->isIdenticalTo($asserter)629 ->if($mock->foo($usedArg))630 ->then631 ->exception(function() use ($asserter) { $asserter->thrice(); })632 ->isInstanceOf('mageekguy\atoum\asserter\exception')633 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 4 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[4] ' . $call->setArguments(array($usedArg)))634 ->if($asserter->withArguments($arg = uniqid()))635 ->then636 ->exception(function() use ($asserter) { $asserter->thrice(); })637 ->isInstanceOf('mageekguy\atoum\asserter\exception')638 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[4] ' . $call->setArguments(array($usedArg)))639 ->if($asserter = new asserters\mock($generator = new asserter\generator()))640 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))641 ->and($asserter->beforeMethodCall('bar')->call('foo'))642 ->then643 ->exception(function() use ($asserter) { $asserter->thrice(); })644 ->isInstanceOf('mageekguy\atoum\asserter\exception')645 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 3'), $asserter->getCall()))646 ->if($mock->foo($usedArg = uniqid()))647 ->then648 ->exception(function() use ($asserter) { $asserter->thrice(); })649 ->isInstanceOf('mageekguy\atoum\asserter\exception')650 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))651 ->if($mock->foo($usedArg))652 ->then653 ->exception(function() use ($asserter) { $asserter->thrice(); })654 ->isInstanceOf('mageekguy\atoum\asserter\exception')655 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 2 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($usedArg)))656 ->if($mock->foo(uniqid()))657 ->then658 ->object($asserter->thrice())->isIdenticalTo($asserter)659 ->if($mock->getMockController()->resetCalls())660 ->and($mock->foo($firstArg = uniqid()))661 ->and($mock->bar(uniqid()))662 ->then663 ->exception(function() use ($asserter) { $asserter->thrice(); })664 ->isInstanceOf('mageekguy\atoum\asserter\exception')665 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($firstArg)))666 ->if($mock->foo($secondArg = uniqid()))667 ->and($mock->bar(uniqid()))668 ->then669 ->exception(function() use ($asserter) { $asserter->thrice(); })670 ->isInstanceOf('mageekguy\atoum\asserter\exception')671 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 2 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($firstArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($secondArg)))672 ->if($mock->foo(uniqid()))673 ->and($mock->bar(uniqid()))674 ->then675 ->object($asserter->thrice())->isIdenticalTo($asserter)676 ->if($asserter = new asserters\mock($generator = new asserter\generator()))677 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))678 ->and($asserter->afterMethodCall('bar')->call('foo'))679 ->then680 ->exception(function() use ($asserter) { $asserter->thrice(); })681 ->isInstanceOf('mageekguy\atoum\asserter\exception')682 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 3'), $asserter->getCall()))683 ->if($mock->getMockController()->resetCalls())684 ->and($mock->bar(uniqid()))685 ->and($mock->foo($firstArg = uniqid()))686 ->then687 ->exception(function() use ($asserter) { $asserter->thrice(); })688 ->isInstanceOf('mageekguy\atoum\asserter\exception')689 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($firstArg)))690 ->if($mock->bar(uniqid()))691 ->and($mock->foo($secondArg = uniqid()))692 ->then693 ->exception(function() use ($asserter) { $asserter->thrice(); })694 ->isInstanceOf('mageekguy\atoum\asserter\exception')695 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 2 times instead of 3'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($firstArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($secondArg)))696 ->if($mock->foo(uniqid()))697 ->then698 ->object($asserter->thrice())->isIdenticalTo($asserter)699 ->if($asserter = new asserters\mock($generator = new asserter\generator()))700 ->and($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))701 ->and($asserter->beforeMethodCall('bar')->withArguments($arg = 'toto')->call('foo'))702 ->and($mock->foo(uniqid()))703 ->then704 ->exception(function() use ($asserter) { $asserter->thrice(); })705 ->isInstanceOf('mageekguy\atoum\asserter\exception')706 ->hasMessage(sprintf($generator->getLocale()->_('method %s is not called'), current($asserter->getBeforeMethodCalls())))707 ->if($mock->foo(uniqid()))708 ->then709 ->exception(function() use ($asserter) { $asserter->thrice(); })710 ->isInstanceOf('mageekguy\atoum\asserter\exception')711 ->hasMessage(sprintf($generator->getLocale()->_('method %s is not called'), current($asserter->getBeforeMethodCalls())))712 ->and($mock->foo(uniqid()))713 ->if($mock->bar($arg))714 ->then715 ->object($asserter->thrice())->isIdenticalTo($asserter)716 ;717 }718 public function testAtLeastOnce()719 {720 $this721 ->if($asserter = new asserters\mock($generator = new asserter\generator()))722 ->then723 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })724 ->isInstanceOf('mageekguy\atoum\exceptions\logic')725 ->hasMessage('Mock is undefined')726 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))727 ->then728 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })729 ->isInstanceOf('mageekguy\atoum\exceptions\logic')730 ->hasMessage('Called method is undefined')731 ->if($asserter->call('foo'))732 ->then733 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })734 ->isInstanceOf('mageekguy\atoum\asserter\exception')735 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time'), $asserter->getCall()))736 ->if($mock->foo(uniqid()))737 ->then738 ->object($asserter->atLeastOnce())->isIdenticalTo($asserter)739 ->if($mock->foo(uniqid()))740 ->then741 ->object($asserter->atLeastOnce())->isIdenticalTo($asserter)742 ->if($mock->getMockController()->resetCalls())743 ->and($asserter->withArguments($usedArg = uniqid()))744 ->then745 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })746 ->isInstanceOf('mageekguy\atoum\asserter\exception')747 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time'), $asserter->getCall()))748 ->if($call = new php\call('foo', null, $mock))749 ->if( $mock->foo($usedArg))750 ->then751 ->object($asserter->atLeastOnce())->isIdenticalTo($asserter)752 ->if($asserter->withArguments($otherArg = uniqid()))753 ->then754 ->exception(function() use ($asserter) { $asserter->atLeastOnce(); })755 ->isInstanceOf('mageekguy\atoum\asserter\exception')756 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))757 ;758 }759 public function testExactly()760 {761 $this762 ->if($asserter = new asserters\mock($generator = new asserter\generator()))763 ->then764 ->exception(function() use ($asserter) { $asserter->exactly(2); })765 ->isInstanceOf('mageekguy\atoum\exceptions\logic')766 ->hasMessage('Mock is undefined')767 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))768 ->then769 ->exception(function() use ($asserter) { $asserter->exactly(2); })770 ->isInstanceOf('mageekguy\atoum\exceptions\logic')771 ->hasMessage('Called method is undefined')772 ->if($asserter->call('foo'))773 ->then774 ->exception(function() use ($asserter) { $asserter->exactly(2); })775 ->isInstanceOf('mageekguy\atoum\asserter\exception')776 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 2'), $asserter->getCall()))777 ->if($call = new php\call('foo', null, $mock))778 ->and($mock->foo($usedArg = uniqid()))779 ->then780 ->exception(function() use ($asserter) { $asserter->exactly(2); })781 ->isInstanceOf('mageekguy\atoum\asserter\exception')782 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))783 ->if($mock->foo($otherUsedArg = uniqid()))784 ->then785 ->object($asserter->exactly(2))->isIdenticalTo($asserter)786 ->if($mock->foo($anOtherUsedArg = uniqid()))787 ->then788 ->exception(function() use ($asserter) { $asserter->exactly(2); })789 ->isInstanceOf('mageekguy\atoum\asserter\exception')790 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 3 times instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($otherUsedArg)) . PHP_EOL . '[3] ' . $call->setArguments(array($anOtherUsedArg)))791 ->if($mock->getMockController()->resetCalls())792 ->and($asserter->withArguments($arg = uniqid()))793 ->then794 ->exception(function() use ($asserter) { $asserter->exactly(2); })795 ->isInstanceOf('mageekguy\atoum\asserter\exception')796 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 2'), $asserter->getCall()))797 ->if($mock->foo($usedArg = uniqid()))798 ->then799 ->exception(function() use ($asserter) { $asserter->exactly(2); })800 ->isInstanceOf('mageekguy\atoum\asserter\exception')801 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))802 ->if($mock->foo($arg))803 ->then804 ->exception(function() use ($asserter) { $asserter->exactly(2); })805 ->isInstanceOf('mageekguy\atoum\asserter\exception')806 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($arg)))807 ->if($mock->foo($arg))808 ->then809 ->object($asserter->exactly(2))->isIdenticalTo($asserter)810 ->if($mock->foo($arg))811 ->then812 ->exception(function() use ($asserter) { $asserter->exactly(2); })813 ->isInstanceOf('mageekguy\atoum\asserter\exception')814 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 3 times instead of 2'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)) . PHP_EOL . '[2] ' . $call->setArguments(array($arg)) . PHP_EOL . '[3] ' . $call->setArguments(array($arg)) . PHP_EOL . '[4] ' . $call->setArguments(array($arg)))815 ->if($call = new php\call('fooWithSeveralArguments', null, $mock))816 ->and($asserter->call('fooWithSeveralArguments'))817 ->then818 ->object($asserter->exactly(0))->isIdenticalTo($asserter)819 ->exception(function() use ($asserter) { $asserter->exactly(1); })820 ->isInstanceOf('mageekguy\atoum\asserter\exception')821 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 1'), $asserter->getCall()))822 ->if($mock->fooWithSeveralArguments(1, 2, 3, 4, 5))823 ->exception(function() use ($asserter) { $asserter->exactly(0); })824 ->isInstanceOf('mageekguy\atoum\asserter\exception')825 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array(1, 2, 3, 4, 5)))826 ->object($asserter->exactly(1))->isIdenticalTo($asserter)827 ->object($asserter->withArguments(1, 2, 3, 4, 5)->exactly(1))->isIdenticalTo($asserter)828 ->object($asserter->withAtLeastArguments(array(1 => 2, 3 => 4))->exactly(1))->isIdenticalTo($asserter)829 ->object($asserter->withAtLeastArguments(array(1 => 2, 3 => rand(6, PHP_INT_MAX)))->exactly(0))->isIdenticalTo($asserter)830 ->exception(function() use ($asserter) { $asserter->withAtLeastArguments(array(1 => 2, 3 => 4))->exactly(0); })831 ->isInstanceOf('mageekguy\atoum\asserter\exception')832 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array(1, 2, 3, 4, 5)))833 ->object($asserter->withIdenticalArguments(1, 2, 3, 4, 5)->exactly(1))->isIdenticalTo($asserter)834 ->exception(function() use ($asserter) { $asserter->withAtLeastIdenticalArguments(array(1 => '2', 3 => 4))->exactly(1); })835 ->isInstanceOf('mageekguy\atoum\asserter\exception')836 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 0 time instead of 1'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array(1, 2, 3, 4, 5)))837 ;838 }839 public function testNever()840 {841 $this842 ->if($asserter = new asserters\mock($generator = new asserter\generator()))843 ->then844 ->exception(function() use ($asserter) { $asserter->never(); })845 ->isInstanceOf('mageekguy\atoum\exceptions\logic')846 ->hasMessage('Mock is undefined')847 ->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))848 ->then849 ->exception(function() use ($asserter) { $asserter->never(); })850 ->isInstanceOf('mageekguy\atoum\exceptions\logic')851 ->hasMessage('Called method is undefined')852 ->if($asserter->call('foo'))853 ->then854 ->object($asserter->never())->isIdenticalTo($asserter)855 ->if($call = new php\call('foo', null, $mock))856 ->and($mock->foo($usedArg = uniqid()))857 ->then858 ->exception(function() use ($asserter) { $asserter->never(); })859 ->isInstanceOf('mageekguy\atoum\asserter\exception')860 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))861 ->if($mock->getMockController()->resetCalls())862 ->and($asserter->withArguments($arg = uniqid()))863 ->then864 ->object($asserter->never())->isIdenticalTo($asserter)865 ->if($mock->foo($arg))866 ->then867 ->exception(function() use ($asserter) { $asserter->never(); })868 ->isInstanceOf('mageekguy\atoum\asserter\exception')869 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($arg)))870 ->if($mock->foo($arg))871 ->then872 ->exception(function() use ($asserter) { $asserter->never(); })873 ->isInstanceOf('mageekguy\atoum\asserter\exception')874 ->hasMessage(sprintf($generator->getLocale()->_('method %s is called 2 times instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($arg)) . PHP_EOL . '[2] ' . $call->setArguments(array($arg)))875 ->if($mock->foo($arg))876 ->then877 ->exception(function() use ($asserter, & $message) { $asserter->never($message = uniqid()); })878 ->isInstanceOf('mageekguy\atoum\asserter\exception')879 ->hasMessage($message)880 ->if($asserter->withArguments(uniqid()))881 ->then882 ->object($asserter->never())->isIdenticalTo($asserter)883 ;884 }885}...

Full Screen

Full Screen

Task_1_Test.php

Source:Task_1_Test.php Github

copy

Full Screen

...16 $ar = new ModelTask_A();17 18 $this->assertTrue($ar->swHasStatus());19 $this->assertTrue($ar->swStatusEquals(SWworkflowTask::S1));20 $this->assertEquals($ar->getCall('task1'),0);21 $this->assertEquals($ar->getCall('task2'),0);22 $this->assertTrue($ar->swNextStatus(SWworkflowTask::S2));23 $this->assertEquals($ar->getCall('task1'),1);24 $this->assertEquals($ar->getCall('task2'),0);25 26 $this->assertTrue($ar->swNextStatus(SWworkflowTask::S4));27 $this->assertEquals($ar->getCall('task1'),1);28 $this->assertEquals($ar->getCall('task2'),1);29 }30 public function test_02() {31 $ar = new ModelTask_A();32 33 $this->assertTrue($ar->swHasStatus());34 $this->assertTrue($ar->swStatusEquals(SWworkflowTask::S1));35 $this->assertEquals($ar->getCall('task1'),0);36 $this->assertEquals($ar->getCall('task2'),0);37 $this->assertTrue($ar->swNextStatus(SWworkflowTask::S3));38 $this->assertEquals($ar->getCall('task1'),1);39 $this->assertEquals($ar->getCall('task2'),0);40 41 $this->assertTrue($ar->swNextStatus(SWworkflowTask::S4));42 $this->assertEquals($ar->getCall('task1'),1);43 $this->assertEquals($ar->getCall('task2'),0);44 45 $this->assertTrue($ar->swNextStatus(SWworkflowTask::S3));46 $this->assertEquals($ar->getCall('task1'),1);47 $this->assertEquals($ar->getCall('task2'),1);48 49 $this->assertTrue($ar->swNextStatus(SWworkflowTask::S4));50 $this->assertEquals($ar->getCall('task1'),1);51 $this->assertEquals($ar->getCall('task2'),1);52 53 $this->assertTrue($ar->swNextStatus(SWworkflowTask::S5));54 $this->assertEquals($ar->getCall('task1'),1);55 $this->assertEquals($ar->getCall('task2'),1);56 $this->assertEquals($ar->getCall('task3'),1);57 58 $this->assertEquals($ar->src,'SWworkflowTask/S4');59 $this->assertEquals($ar->trg,'SWworkflowTask/S5');60 61 $this->assertTrue($ar->swCreateNode($ar->src)->equals(SWworkflowTask::S4));62 $this->assertTrue($ar->swCreateNode($ar->trg)->equals(SWworkflowTask::S5));63 }64 65 public function test_03() {66 $component = Yii::createComponent(67 array(68 'class'=>'application.extensions.simpleWorkflow.SWPhpWorkflowSource',69 'basePath'=> 'application.tests.unit.task.workflows'70 )71 );72 Yii::app()->setComponent('swSource', $component);73 74 $ar = new ModelTask_B();75 76 $this->assertTrue($ar->swHasStatus());77 $this->assertTrue($ar->swStatusEquals('S1'));78 $this->assertEquals($ar->getCall('task1'),0);79 $this->assertEquals($ar->getCall('task2'),0);80 81 $this->assertTrue($ar->swNextStatus('S2'));82 $this->assertEquals($ar->getCall('task1'),1);83 $this->assertEquals($ar->getCall('task2'),0);84 85 $this->assertTrue($ar->swNextStatus('S4'));86 $this->assertEquals($ar->getCall('task1'),1);87 $this->assertEquals($ar->getCall('task2'),0);88 $this->assertEquals($ar->getCall('task3'),0);89 90 } ...

Full Screen

Full Screen

getCall

Using AI Code Generation

copy

Full Screen

1include_once('call.php');2$call = new call();3$call->getCall();4include_once('call.php');5$call = new call();6$call->getCall();7include_once('call.php');8$call = new call();9$call->getCall();10include_once('call.php');11$call = new call();12$call->getCall();13include_once('call.php');14$call = new call();15$call->getCall();16include_once('call.php');17$call = new call();18$call->getCall();19include_once('call.php');20$call = new call();21$call->getCall();22include_once('call.php');23$call = new call();24$call->getCall();25include_once('call.php');26$call = new call();27$call->getCall();28include_once('call.php');29$call = new call();30$call->getCall();31include_once('call.php');32$call = new call();33$call->getCall();34include_once('call.php');35$call = new call();36$call->getCall();37include_once('call.php');38$call = new call();39$call->getCall();40include_once('call.php');41$call = new call();42$call->getCall();

Full Screen

Full Screen

getCall

Using AI Code Generation

copy

Full Screen

1$call = new call();2$call->getCall($callid);3$call = new call();4$call->setCall($callid, $callstatus);5$call = new call();6$call->getCall($callid);7$call = new call();8$call->setCall($callid, $callstatus);9$call = new call();10$call->getCall($callid);11$call = new call();12$call->setCall($callid, $callstatus);13$call = new call();14$call->getCall($callid);15$call = new call();16$call->setCall($callid, $callstatus);17$call = new call();18$call->getCall($callid);19$call = new call();20$call->setCall($callid, $callstatus);21$call = new call();22$call->getCall($callid);23$call = new call();24$call->setCall($callid, $callstatus);25$call = new call();26$call->getCall($callid);27$call = new call();28$call->setCall($callid, $callstatus);29$call = new call();

Full Screen

Full Screen

getCall

Using AI Code Generation

copy

Full Screen

1$call = new Call();2$call->getCall($callid);3$call = new Call();4$call->getCall($callid);5$call = new Call();6$call->getCall($callid);7$call = new Call();8$call->getCall($callid);9$call = new Call();10$call->getCall($callid);11$call = new Call();12$call->getCall($callid);13$call = new Call();14$call->getCall($callid);15$call = new Call();16$call->getCall($callid);17$call = new Call();18$call->getCall($callid);19$call = new Call();20$call->getCall($callid);21$call = new Call();22$call->getCall($callid);23$call = new Call();24$call->getCall($callid

Full Screen

Full Screen

getCall

Using AI Code Generation

copy

Full Screen

1$call = new call();2$call->getCall();3$call = new call();4$call->getCall();5$call = new call();6$call->getCall();7$call = new call();8$call->getCall();9$call = new call();10$call->getCall();11$call = new call();12$call->getCall();13$call = new call();14$call->getCall();15$call = new call();16$call->getCall();17$call = new call();18$call->getCall();19$call = new call();

Full Screen

Full Screen

getCall

Using AI Code Generation

copy

Full Screen

1include_once "call.php";2$call = new call();3$callDetails = $call->getCall();4if ($callDetails['callStatus'] == "inbound") {5 $callId = $callDetails['callId'];6 $callerNumber = $callDetails['callerNumber'];7 $calledNumber = $callDetails['calledNumber'];8 $callStatus = $callDetails['callStatus'];9 $callStartTime = $callDetails['callStartTime'];10 $callEndTime = $callDetails['callEndTime'];11 $callDuration = $callDetails['callDuration'];12 $callRecordingUrl = $callDetails['callRecordingUrl'];13 $callRecordingDuration = $callDetails['callRecordingDuration'];14 $callRecordingStatus = $callDetails['callRecordingStatus'];15 $callRecordingId = $callDetails['callRecordingId'];16 $callRecordingFileName = $callDetails['callRecordingFileName'];17 $callRecordingFileFormat = $callDetails['callRecordingFileFormat'];18 $callRecordingFileSize = $callDetails['callRecordingFileSize'];19 $callRecordingFileUrl = $callDetails['callRecordingFileUrl'];20 $callRecordingStatus = $callDetails['callRecordingStatus'];21 $callRecordingId = $callDetails['callRecordingId'];22 $callRecordingFileName = $callDetails['callRecordingFileName'];23 $callRecordingFileFormat = $callDetails['callRecordingFileFormat'];24 $callRecordingFileSize = $callDetails['callRecordingFileSize'];25 $callRecordingFileUrl = $callDetails['callRecordingFileUrl'];

Full Screen

Full Screen

getCall

Using AI Code Generation

copy

Full Screen

1require_once('call.php');2$call = new Call();3$call->getCall();4echo $call->callDetails();5require_once('call.php');6$call = new Call();7$call->getCall();8echo $call->callDetails();9require_once('call.php');10$call = new Call();11$call->getCall();12echo $call->callDetails();13require_once('call.php');14$call = new Call();15$call->getCall();16echo $call->callDetails();17require_once('call.php');18$call = new Call();19$call->getCall();20echo $call->callDetails();21require_once('call.php');22$call = new Call();23$call->getCall();24echo $call->callDetails();25require_once('call.php');26$call = new Call();27$call->getCall();28echo $call->callDetails();29require_once('call.php');30$call = new Call();31$call->getCall();32echo $call->callDetails();33require_once('call.php');34$call = new Call();35$call->getCall();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful