示例#1
0
 /**
  * @dataProvider setTemplateDataProvider
  */
 public function testSetTemplate($classExists, $controllerName)
 {
     if ($classExists) {
         $this->mockAutoloadedController($controllerName);
     } else {
         $this->setExpectedException('WikiaException');
     }
     $this->object->setTemplate($controllerName, 'hello');
     if ($classExists) {
         $this->assertEquals(dirname(__FILE__) . '/_fixtures/templates/' . $controllerName . '_hello.php', $this->object->getTemplatePath());
     }
     $this->unmockAutoloadedController($controllerName);
 }
示例#2
0
 /**
  * @dataProvider setTemplateDataProvider
  */
 public function testSetTemplate($classExists, $controllerName)
 {
     $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($classExists ? $this->returnValue(array($controllerName . 'Controller' => dirname(__FILE__) . '/_fixtures/TestController.php')) : $this->returnValue(array()));
     $appMock->setGlobalRegistry($registryMock);
     F::setInstance('App', $appMock);
     if (!$classExists) {
         $this->setExpectedException('WikiaException');
     }
     $this->object->setTemplate($controllerName, 'hello');
     if ($classExists) {
         $this->assertEquals(dirname(__FILE__) . '/_fixtures/templates/' . $controllerName . '_hello.php', $this->object->getTemplatePath());
     }
 }