Example #1
0
 public function testHasStatus()
 {
     $this->if($object = new TestedClass($generator = new asserter\generator()))->and($response = new \mock\Symfony\Component\HttpFoundation\Response())->and($this->calling($response)->getStatusCode = function () use(&$status) {
         return $status;
     })->and($object->setWith($response))->and($status = rand(400, 500))->then->exception(function () use($object, &$value) {
         $object->hasStatus($value = rand(200, 300));
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('Status %s is not equal to %s'), $object->getAnalyzer()->getTypeOf($status), $object->getAnalyzer()->getTypeOf($value)))->if($status = rand(200, 300))->then->object($object->hasStatus($status))->isIdenticalTo($object);
 }