/** * If a previous search is recorded in the session, return a link to it; * otherwise, return a blank string. * * @param string $link Text to use as body of link * @param string $prefix Text to place in front of link * @param string $suffix Text to place after link * * @return string */ public function getLastSearchLink($link, $prefix = '', $suffix = '') { $last = $this->memory->retrieveSearch(); if (!empty($last)) { $escaper = $this->getView()->plugin('escapeHtml'); return $prefix . '<a href="' . $escaper($last) . '">' . $link . '</a>' . $suffix; } return ''; }
/** * Test disabling the memory. * * @return void */ public function testDisable() { $mem = new Memory(); $url = 'http://test'; $mem->rememberSearch($url); $this->assertEquals($url, $mem->retrieveSearch()); $mem->disable(); $mem->rememberSearch('http://ignoreme'); $this->assertEquals($url, $mem->retrieveSearch()); }