/**
  * Test element method
  * 
  * @return void
  */
 public function testElement()
 {
     $this->__mockView();
     $this->CommentWidget->options(array('theme' => 'flat'));
     $countElementCall = 0;
     $expectedParams = array('comments/flat/view', array('target' => false, 'ajaxAction' => false, 'displayUrlToComment' => false, 'urlToComment' => '', 'allowAnonymousComment' => false, 'url' => null, 'ajaxOptions' => array(), 'viewInstance' => null, 'theme' => 'flat'));
     $this->View->expectAt($countElementCall, 'element', $expectedParams);
     $expected = 'Comment element content';
     $this->View->setReturnValueAt($countElementCall++, 'element', $expected);
     $this->assertEqual($this->CommentWidget->element('view'), $expected);
     // Test missing element in project elements path. The helper must try to search the element from the comments plugin
     $this->View->expectAt($countElementCall, 'element', $expectedParams);
     $this->View->setReturnValueAt($countElementCall++, 'element', 'Not Found: /path/to/project/views/elements/comments/flat/view.ctp');
     $expectedParams[1]['plugin'] = 'comments';
     $this->View->expectAt($countElementCall, 'element', $expectedParams);
     $this->View->setReturnValueAt($countElementCall++, 'element', $expected);
     $this->assertEqual($this->CommentWidget->element('view'), $expected);
     unset($expectedParams[1]['plugin']);
     // Test params: they must be passed to the element "as is". Note that the theme has not effect on the element being fetched
     $expectedParams[1]['target'] = 'wrapper';
     $expectedParams[1]['theme'] = 'threaded';
     $this->View->expectAt($countElementCall, 'element', $expectedParams);
     $this->View->setReturnValueAt($countElementCall++, 'element', $expected);
     $this->assertEqual($this->CommentWidget->element('view', array('target' => 'wrapper', 'theme' => 'threaded')), $expected);
     $this->View->expectCallCount('element', $countElementCall);
 }
 public function testElementParams()
 {
     $this->CommentWidget->options(array('theme' => 'flat'));
     $expectedParams = array('comments/flat/view', array('target' => false, 'ajaxAction' => false, 'displayUrlToComment' => false, 'urlToComment' => '', 'allowAnonymousComment' => false, 'url' => null, 'ajaxOptions' => array(), 'viewInstance' => null, 'theme' => 'flat'));
     // Test params: they must be passed to the element "as is". Note that the theme has not effect on the element being fetched
     $expectedParams[1]['target'] = 'wrapper';
     $expectedParams[1]['theme'] = 'threaded';
     $this->View->expects($this->at(0))->method('element')->with($this->equalTo($expectedParams[0]), $this->equalTo($expectedParams[1]));
     $expected = 'Comment element content';
     $this->View->expects($this->at(1))->method('element')->will($this->returnValue($expected));
     $this->assertEqual($this->CommentWidget->element('view', array('target' => 'wrapper', 'theme' => 'threaded')), $expected);
 }