/** * Test link method * * @return void */ public function testLink() { $result = $this->CommentWidget->link('Foobar', '/foo', array('class' => 'bar')); $expected = array('a' => array('href' => '/foo', 'class' => 'bar'), 'Foobar', '/a'); $this->assertTags($result, $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' => 'wrapper', 'ajaxOptions' => array('update' => 'wrapper'))); $this->Js->expects($this->once())->method('link')->with($this->equalTo('Foobar'), $this->equalTo('/foo'), $this->equalTo(array('update' => 'wrapper', 'class' => 'bar')))->will($this->returnValue('/ajaxFoo')); $result = $this->CommentWidget->link('Foobar', '/foo', array('class' => 'bar')); $this->assertEqual($result, '/ajaxFoo'); }
/** * Test link method * * @return void */ public function _testLink() { $result = $this->CommentWidget->link('Foobar', '/foo', array('class' => 'bar')); $expected = array('a' => array('href' => '/foo', 'class' => 'bar'), 'Foobar', '/a'); $this->assertTags($result, $expected); $this->Js->setReturnValue('get', $this->Js); $this->Js->setReturnValue('effect', ''); $this->CommentWidget->options(array('target' => 'wrapper', 'ajaxOptions' => array('update' => 'wrapper'))); $this->Js->expectOnce('link', array('Foobar', '/foo', array('update' => 'wrapper', 'class' => 'bar'))); $this->Js->setReturnValueAt(0, 'link', '/ajaxFoo'); $result = $this->CommentWidget->link('Foobar', '/foo', array('class' => 'bar')); $this->assertEqual($result, '/ajaxFoo'); }