From 1222e61ebbd138b2942263bb0a323e5cae951b3d Mon Sep 17 00:00:00 2001 From: PJ Dietz Date: Sat, 26 Jul 2014 05:20:22 -0400 Subject: [PATCH] Update Handler tests --- test/HandlerTest.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/test/HandlerTest.php b/test/HandlerTest.php index 64a4b9c..ca0f732 100644 --- a/test/HandlerTest.php +++ b/test/HandlerTest.php @@ -2,23 +2,23 @@ namespace pjdietz\WellRESTed\Test; -use pjdietz\WellRESTed\Exceptions\HttpExceptions\HttpException; use pjdietz\WellRESTed\Exceptions\HttpExceptions\NotFoundException; use pjdietz\WellRESTed\Handler; class HandlerTest extends \PHPUnit_Framework_TestCase { - public function testResponse() + public function testGetResponse() { $mockRequest = $this->getMock('\pjdietz\WellRESTed\Interfaces\RequestInterface'); $mockHandler = $this->getMockForAbstractClass('\pjdietz\WellRESTed\Handler'); + /** @var \pjdietz\WellRESTed\Handler $mockHandler */ $this->assertNotNull($mockHandler->getResponse($mockRequest)); } /** * @dataProvider verbProvider */ - public function testVerb($verb) + public function testCallMethodForHttpVerb($verb) { $mockRequest = $this->getMock('\pjdietz\WellRESTed\Interfaces\RequestInterface'); $mockRequest->expects($this->any()) @@ -26,6 +26,7 @@ class HandlerTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($verb)); $mockHandler = $this->getMockForAbstractClass('\pjdietz\WellRESTed\Handler'); + /** @var \pjdietz\WellRESTed\Handler $mockHandler */ $this->assertNotNull($mockHandler->getResponse($mockRequest)); } @@ -43,7 +44,7 @@ class HandlerTest extends \PHPUnit_Framework_TestCase ]; } - public function testHttException() + public function testTranslateHttpExceptionToResponse() { $mockRequest = $this->getMock('\pjdietz\WellRESTed\Interfaces\RequestInterface'); $mockRequest->expects($this->any()) @@ -55,18 +56,13 @@ class HandlerTest extends \PHPUnit_Framework_TestCase $this->assertEquals(404, $resp->getStatusCode()); } - public function testAllowedMethods() + public function testReadAllowedMethods() { $mockRequest = $this->getMock('\pjdietz\WellRESTed\Interfaces\RequestInterface'); $mockRequest->expects($this->any()) ->method('getMethod') ->will($this->returnValue("OPTIONS")); - $mockHandler = $this->getMockForAbstractClass('\pjdietz\WellRESTed\Handler'); - $mockHandler->expects($this->any()) - ->method('getAllowedMethods') - ->will($this->returnValue(["GET","POST"])); - $handler = new OptionsHandler(); $resp = $handler->getResponse($mockRequest);