function testCleanLog() { $stats_request = new StatsRequest(); $stats_request->setTime($time = time()); $stats_request->setAction($action = 'test'); $stats_request->setClientIp('127.0.0.1'); $referer_uri = new Uri('http://example.com'); $uri = new Uri('http://test.com'); $stats_request->setRefererUri($referer_uri); $stats_request->setUri($uri); $this->stats_referer->setReturnValue('getId', $refered_id = 1); $this->stats_uri->setReturnValue('getId', $uri_id = 2); $this->register->register($stats_request); $stats_request->setTime(time() + 2 * 60 * 60 * 24); $this->register->register($stats_request); $stats_request->setTime(time() + 3 * 60 * 60 * 24); $this->register->register($stats_request); $stats_request->setTime(time() + 4 * 60 * 60 * 24); $this->register->register($stats_request); $stats_request->setTime(time() + 5 * 60 * 60 * 24); $this->register->register($stats_request); $stats_request->setTime(time() + 6 * 60 * 60 * 24); $this->register->register($stats_request); $this->register->cleanUntil(time() + 4 * 60 * 60 * 24 - 10); $rs =& $this->db->select('stats_hit'); $this->assertEqual(3, $rs->getTotalRowCount()); }