示例#1
0
 /**
  * @dataProvider testRenderingFormatsDataProvider
  */
 public function testRenderingFormats($format, $responseValueName, $responseValueData, $expectedResult)
 {
     $response = new WikiaResponse($format);
     $response->setVal($responseValueName, $responseValueData);
     $this->object->setResponse($response);
     if ($format == WikiaResponse::FORMAT_HTML) {
         $this->mockAutoloadedController('Test');
         $this->object->setTemplate('Test', 'formatHTML');
     }
     $this->assertEquals($expectedResult, $this->object->render());
     $this->unmockAutoloadedController('Test');
 }
示例#2
0
 /**
  * @dataProvider testRenderingFormatsDataProvider
  */
 public function testRenderingFormats($format, $responseValueName, $responseValueData, $expectedResult)
 {
     $response = F::build('WikiaResponse', array($format));
     $response->setVal($responseValueName, $responseValueData);
     $this->object->setResponse($response);
     if ($format == WikiaResponse::FORMAT_HTML) {
         $appMock = $this->getMock('WikiaApp', array('ajax'));
         /* @var $appMock WikiaApp */
         $registryMock = $this->getMock('WikiaGlobalRegistry', array('get'));
         $registryMock->expects($this->any())->method('get')->with($this->equalTo('wgAutoloadClasses'))->will($this->returnValue(array('Test' . 'Controller' => dirname(__FILE__) . '/_fixtures/TestController.php')));
         $appMock->setGlobalRegistry($registryMock);
         F::setInstance('App', $appMock);
         $this->object->setTemplate('Test', 'formatHTML');
     }
     $this->assertEquals($expectedResult, $this->object->render());
 }
 /**
  * set view
  * @param WikiaView $view
  */
 public function setView(WikiaView $view)
 {
     $this->view = $view;
     $this->view->setResponse($this);
 }