/** * @test */ public function route() { $routeEventValues = ['request' => $this->mockedRequest]; $matchEventValues = ['route' => $this->subject->getRoute('test')]; $this->mockedEventDispatcher->shouldReceive('dispatchEvent')->with('router.pre_route', $routeEventValues, $this->subject)->andReturn($this->mockedEvent); $this->mockedEventDispatcher->shouldReceive('dispatchEvent')->with('router.post_route', $routeEventValues, $this->subject)->andReturn($this->mockedEvent); $this->mockedEventDispatcher->shouldReceive('dispatchEvent')->with('router.pre_match', $matchEventValues, $this->subject)->andReturn($this->mockedEvent); $this->mockedEventDispatcher->shouldReceive('dispatchEvent')->with('router.post_match', $matchEventValues, $this->subject)->andReturn($this->mockedEvent); $this->mockedRequest->shouldReceive('getProperties')->andReturn($this->mockedData)->shouldReceive('getPathInfo')->andReturn('/name/first/last'); $this->mockedData->shouldReceive('get')->andReturn($this->mockedData)->shouldReceive('setValues'); $this->assertInstanceOf('Neat\\Http\\Request', $this->subject->route()); }
/** * @test */ public function getTemplate_returnsString() { $this->mockedRequest->shouldReceive('get')->with('action')->andReturn('default'); $this->assertSame('default.html', $this->invokeMethod('getTemplate')); }