Exemplo n.º 1
0
 /**
  * testLoadHelpers method
  *
  * @access public
  * @return void
  */
 function testLoadHelpers()
 {
     $View = new TestView($this->PostsController);
     $loaded = array();
     $result = $View->loadHelpers($loaded, array('Html', 'Form', 'Ajax'));
     $this->assertTrue(is_object($result['Html']));
     $this->assertTrue(is_object($result['Form']));
     $this->assertTrue(is_object($result['Form']->Html));
     $this->assertTrue(is_object($result['Ajax']->Html));
     $View->plugin = 'test_plugin';
     $result = $View->loadHelpers($loaded, array('TestPlugin.PluggedHelper'));
     $this->assertTrue(is_object($result['PluggedHelper']));
     $this->assertTrue(is_object($result['PluggedHelper']->OtherHelper));
 }
Exemplo n.º 2
0
 /**
  * Test elementCacheHelperNoCache method
  *
  * @return void
  */
 public function testElementCacheHelperNoCache()
 {
     $Controller = new ViewPostsController();
     $View = new TestView($Controller);
     $View->loadHelpers();
     $result = $View->element('test_element', array('ram' => 'val', 'test' => array('foo', 'bar')));
     $this->assertEquals('this is the test element', $result);
 }
Exemplo n.º 3
0
 /**
  * test the correct triggering of helper callbacks
  *
  * @return void
  */
 function testHelperCallbackTriggering()
 {
     $this->PostsController->helpers = array('Html', 'CallbackMock');
     $View = new TestView($this->PostsController);
     $loaded = array();
     $View->loaded = $View->loadHelpers($loaded, $this->PostsController->helpers);
     $View->loaded['CallbackMock']->expectOnce('beforeRender');
     $View->loaded['CallbackMock']->expectOnce('afterRender');
     $View->loaded['CallbackMock']->expectOnce('beforeLayout');
     $View->loaded['CallbackMock']->expectOnce('afterLayout');
     $View->render('index');
 }