* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class RequestMethodChoiceTest extends FilterTestCase { public function testCorrectMethod() { $request = new Request(new Url('http://localhost'), 'GET'); $response = new Response(); $response->setBody(new StringStream()); $filter = $this->getMockBuilder(FilterInterface::class) ->setMethods(array('handle')) ->getMock(); $filter->expects($this->once()) ->method('handle') ->with($this->equalTo($request), $this->equalTo($response)); $handle = new RequestMethodChoice(array('GET'), $filter); $handle->handle($request, $response, $this->getFilterChain(false)); } public function testWrongMethod() { $request = new Request(new Url('http://localhost'), 'GET'); $response = new Response(); $response->setBody(new StringStream()); $filter = $this->getMockBuilder(FilterInterface::class) ->setMethods(array('handle')) ->getMock(); $filter->expects($this->never()) ->method('handle'); $handle = new RequestMethodChoice(array('POST', 'PUT', 'DELETE'), $filter); $handle->handle($request, $response, $this->getFilterChain(true, $request, $response)); } } __halt_compiler();----SIGNATURE:----xLlWwKhD8YGxDjGgUi0l8+nx8JDqC/fG5h1RVgcD3QrUz9wrNi7BJIu5ruZyfHIDJjo0l08TnQRTIAToFTi6+P9TGGbgbS098+4FtE10DoDHwNPEtjjfNVudAo+2bbKkSn1/nQZ6dKt24Fo84YNbmhyk6ATooJ7ultkeUtozO6oMM9hrOk6s5FRjdDRx0tiPNK2+xq0XUNEF75XKOn22BEvprgyA+sC3unpPUjrm1Mo55sZi1xS8yAr4a0ZFIFRIU361e5sEUydLliLcjKEXQ+KeggMo+vYaKYz8rfA2BysX140RveRHQB0HgG73mX1RkuK/UnK2DnxQOXsx63H3lg9q7ZNsVgCsCD3Z8GsMqyaQJ+f2NqOyCTWon9CeF82zUoScTAY7a2EDGYs3g32tapBJYpFcxPWOOORE/Lu2e+dzIkstTMgpMpIf4KTLfM6VN0g/SPzvtKQRCAerntGXdutOx7fezSLW4uSRQ86H+F/+ahFwdj4SzlGmhz4EO7NTX+etzZdbiwfDPzQincALWcc0Vp24A+EgR16UuE3AZpBEaphIExXHvt62R0zCBKhSmcbK4qOh9GWrphXJtbHJPJ9sovtj1mmBcQM4+D8CmlyIdrsTTCMKtgeHIFrV4+odUUK2v+OkSFucDcWsuCJEocsu24smju1jcE7aiIh+P8Q=----ATTACHMENT:----Nzg5ODMzODY4MDc2OTQ3NCAzMzMzOTk4OTczNzA0ODI0IDYxOTA4MDE5MDUyOTUxMzU=