Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added unit test for patch

- PATCH without an identifier should raise an exception
  • Loading branch information...
commit c0825f96e6b4314e50e39f3ece8ece471da13917 1 parent ea669b2
Matthew Weier O'Phinney authored January 18, 2013
14  tests/ZendTest/Mvc/Controller/RestfulControllerTest.php
@@ -366,4 +366,18 @@ public function testRequestingContentTypeReturnsFalseForInvalidMatches($contentT
366 366
         $this->request->getHeaders()->addHeaderLine('Content-Type', $contentType);
367 367
         $this->assertFalse($this->controller->requestHasContentType($this->request, TestAsset\RestfulTestController::CONTENT_TYPE_JSON));
368 368
     }
  369
+
  370
+    public function testDispatchViaPatchWithoutIdentifierRaisesException()
  371
+    {
  372
+        $entity = new stdClass;
  373
+        $entity->name = 'foo';
  374
+        $entity->type = 'standard';
  375
+        $this->controller->entity = $entity;
  376
+        $entity = array('name' => __FUNCTION__);
  377
+        $string = http_build_query($entity);
  378
+        $this->request->setMethod('PATCH')
  379
+                      ->setContent($string);
  380
+        $this->setExpectedException('Zend\Mvc\Exception\DomainException', 'identifier');
  381
+        $result = $this->controller->dispatch($this->request, $this->response);
  382
+    }
369 383
 }

0 notes on commit c0825f9

Please sign in to comment.
Something went wrong with that request. Please try again.