示例#1
0
 /**
  * Getter for the View instance variable.
  *
  * @return MvcLite\View
  */
 public function getView()
 {
     if (!$this->view) {
         $this->view = \MvcLite\View::getInstance();
     }
     return $this->view;
 }
示例#2
0
 /**
  * The setup method, called before each test
  */
 public function setUp()
 {
     $this->sut = View::getInstance();
 }
示例#3
0
 /**
  * Tests the MvcLite\View::getHelper method.
  *
  * @dataProvider provideGetHelper
  * @runInSeparateProcess
  */
 public function testGetHelper($helper, $helpers = [], $exception = false)
 {
     if ($exception) {
         $this->setExpectedException('\\MvcLite\\Exception');
     }
     $loader = $this->getMockBuilder('\\Composer\\Loader\\Autoloader')->disableOriginalConstructor()->setMethods(['loadClass'])->getMock();
     $loader->expects($this->any())->method('loadClass')->will($this->returnValueMap([['\\App\\View\\Helper\\' . ucfirst($helper), false], ['\\MvcLite\\View\\Helper\\' . ucfirst($helper), $exception ? false : true]]));
     $sut = \MvcLite\View::getInstance();
     $this->setReflectionPropertyValue($sut, 'helpers', $helpers);
     $sut->setLoader($loader);
     $result = $sut->getHelper($helper);
     $this->assertInstanceOf('\\MvcLite\\View\\HelperAbstract', $result);
 }