* @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:----RRsYldjc7DxpKcLbyn8vgD8h4q7NiPvb5PMh9KHlncaB1cQmltGKELb8v9IB4ytziU23BfZ7VzjQVhELpjeRLZ7DS/fowvjpjQa3c4HWfuWydQjpVR5MYAwKiEK7bfwRvudmaqFxaK/pNwgbtSERdeI9I5RqjHZFqBemkzYUy8ueEPexKr6uxZoXmKwDgJ7tnii3hysFJNq8AJIBk9XkhMbvh3ZjpKWpWe0BBRr4bseVTMz/7AjY0E39HhU5NqDebZTF1+6bl13uh+BJm+s2hIHjxBna8C7CEvcXw4YOz/uCDMUooyhzFCnOLhcT9HSp4rfBd+AxkyAI2Y51fk5GeOgUClvK3UmJk0NbELrhaLpVmCLqTIs89vlicD3GuiNuZ8lkJcGWZalUXzfcw32z+M2a0FfLjJaXXk0a3aUtdJu5S/cL844xcqQV10AibxGTsPciij1lVC9M1xFobhyLyXHIwIHl5wADi42OGI350T5tYvV5KmAo1M7Pzo2Wd8DrTuCQ3P1uwHUy7Ja1HG+IyURb2ycdQXOqPuInEV3Y38VNLkgB5JPcmMFoMqA2o9qYYIaSgrKBaHtEXBlb1a+mImN95qK5y6jRtjgFRm7zBp3cVGD/HpzYhpfv7YEJBF5RkAIsEhGoMe2UimEcgMalQpHVbCKWmyTH0T5mS6FIXxo=----ATTACHMENT:----MTIwMzU1NTk5Njk3MjAyNiA5MTA3MjM1ODM2MDc3OTgyIDI4NDIzNjYxNDU0NTY2NA==