/**
  * @covers \DoctrineORMModule\Yuml\YumlController::indexAction
  */
 public function testIndexActionWillRedirectToYuml()
 {
     $response = $this->getMock('Zend\\Http\\Response');
     $controllerResponse = $this->getMock('Zend\\Http\\Response');
     $redirect = $this->getMock('Zend\\Mvc\\Controller\\Plugin\\Redirect');
     $this->httpClient->expects($this->any())->method('send')->will($this->returnValue($response));
     $response->expects($this->any())->method('isSuccess')->will($this->returnValue(true));
     $response->expects($this->any())->method('getBody')->will($this->returnValue('short-url'));
     $this->pluginManager->expects($this->any())->method('get')->with('redirect')->will($this->returnValue($redirect));
     $redirect->expects($this->any())->method('toUrl')->with('http://yuml.me/short-url')->will($this->returnValue($controllerResponse));
     $this->assertSame($controllerResponse, $this->controller->indexAction());
 }
示例#2
0
 /**
  * @covers \OcraServiceManager\Controller\YumlController::indexAction
  */
 public function testIndexActionWillRedirectToYuml()
 {
     $this->serviceLocator->expects($this->any())->method('get')->with('Config')->will($this->returnValue(array('ocra_service_manager' => array('logged_service_manager' => true), 'zenddevelopertools' => array('toolbar' => array('enabled' => true)))));
     $client = $this->getMock('Zend\\Http\\Client');
     $response = $this->getMock('Zend\\Http\\Response');
     $controllerResponse = $this->getMock('Zend\\Http\\Response');
     $redirect = $this->getMock('Zend\\Mvc\\Controller\\Plugin\\Redirect');
     $client->expects($this->any())->method('send')->will($this->returnValue($response));
     $response->expects($this->any())->method('isSuccess')->will($this->returnValue(true));
     $response->expects($this->any())->method('getBody')->will($this->returnValue('short-url'));
     $this->pluginManager->expects($this->any())->method('get')->with('redirect')->will($this->returnValue($redirect));
     $redirect->expects($this->any())->method('toUrl')->with('http://yuml.me/short-url')->will($this->returnValue($controllerResponse));
     $this->controller->setHttpClient($client);
     $this->assertSame($controllerResponse, $this->controller->indexAction());
 }