示例#1
0
 public function testHasAge()
 {
     $this->if($object = new TestedClass($generator = new asserter\generator()))->and($response = new \mock\Symfony\Component\HttpFoundation\Response())->and($this->calling($response)->getAge = function () use(&$age) {
         return $age;
     })->and($object->setWith($response))->and($age = rand(0, 100))->then->exception(function () use($object, &$value) {
         $object->hasAge($value = rand(200, PHP_INT_MAX));
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('Age %s is not equal to %s'), $object->getAnalyzer()->getTypeOf($age), $object->getAnalyzer()->getTypeOf($value)))->if($age = rand(200, 300))->then->object($object->hasAge($age))->isIdenticalTo($object);
 }