public function testDispatch() { $request = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Request', [], [], '', false); $response = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Response', [], [], '', false); $routeMatch = $this->getMock('\\Zend\\Mvc\\Router\\RouteMatch', [], [], '', false); $mvcEvent = $this->getMock('\\Zend\\Mvc\\MvcEvent', [], [], '', false); $mvcEvent->expects($this->once())->method('setRequest')->with($request)->willReturn($mvcEvent); $mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($mvcEvent); $mvcEvent->expects($this->once())->method('setTarget')->with($this->controller)->willReturn($mvcEvent); $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch); $contentArray = '{"config": { "address": { "base_url": "http://123.45.678.12"}}}'; $request->expects($this->any())->method('getContent')->willReturn($contentArray); $this->controller->setEvent($mvcEvent); $this->controller->dispatch($request, $response); $this->controller->startAction(); }