Example #1
0
 public function testHasTtl()
 {
     $this->if($object = new TestedClass($generator = new asserter\generator()))->and($response = new \mock\Symfony\Component\HttpFoundation\Response())->and($this->calling($response)->getTtl = function () use(&$ttl) {
         return $ttl;
     })->and($object->setWith($response))->and($ttl = rand(0, 100))->then->exception(function () use($object, &$value) {
         $object->hasTtl($value = rand(200, PHP_INT_MAX));
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('TTL %s is not equal to %s'), $object->getTypeOf($ttl), $object->getTypeOf($value)))->if($ttl = uniqid())->then->object($object->hasTtl($ttl))->isIdenticalTo($object);
 }