/** * Test admin_view action * * @return void */ public function testAdminView() { $this->Comments->admin_view('invalid-comment'); $this->assertEqual($this->Comments->redirectUrl, array('action' => 'index')); $this->assertEqual($this->Comments->Session->read('Message.flash.message'), 'Invalid Comment.'); $this->Comments->Session->delete('Message.flash.message'); $this->Comments->admin_view(1); $this->assertEqual($this->Comments->viewVars['comment']['Comment']['id'], 1); }
/** * Test admin_view action * * @return void */ public function testAdminView() { $this->Collection = $this->getMock('ComponentCollection'); $this->Comments->Session = $this->getMock('SessionComponent', array('setFlash'), array($this->Collection)); $this->Comments->Session->expects($this->once())->method('setFlash')->with(__d('comments', 'Invalid Comment.')); $this->Comments->admin_view('invalid-comment'); $this->assertEqual($this->Comments->redirectUrl, array('action' => 'index')); $this->Comments->admin_view(1); $this->assertEqual($this->Comments->viewVars['comment']['Comment']['id'], 1); }