/** * Test prepareUrl method * * @return void */ public function testPrepareUrl() { $expected = $url = array('controller' => 'articles', 'action' => 'view', 'my-first-article'); $this->assertEqual($this->CommentWidget->prepareUrl($url), $expected); $this->Js->expects($this->any())->method('get')->will($this->returnValue($this->Js)); $this->Js->expects($this->any())->method('effect')->will($this->returnValue('')); $this->CommentWidget->options(array('target' => 'placeholder', 'ajaxAction' => 'add')); $expected['action'] = 'add'; $this->assertEqual($this->CommentWidget->prepareUrl($url), $expected); $this->CommentWidget->options(array('target' => 'placeholder', 'ajaxAction' => array('controller' => 'comments', 'action' => 'add'))); $expected = array('controller' => 'comments', 'action' => 'add', 'my-first-article'); $this->assertEqual($this->CommentWidget->prepareUrl($url), $expected); }