/** * Import page counters * * @return string */ function importPageCounters($a_pagecounters, $items_id) { $pfPrinterLog = new PluginFusioninventoryPrinterLog(); //See if have an entry today $a_entires = $pfPrinterLog->find("`printers_id`='" . $items_id . "'\n AND LEFT(`date`, 10)='" . date("Y-m-d") . "'", "", 1); if (count($a_entires) > 0) { return; } $a_pagecounters['printers_id'] = $items_id; $a_pagecounters['date'] = date("Y-m-d H:i:s"); $pfPrinterLog->add($a_pagecounters); }
/** * @test */ public function PrinterPageCounter() { global $DB; $DB->connect(); $pfPrinterLog = new PluginFusioninventoryPrinterLog(); $a_pages = $pfPrinterLog->find("`printers_id`='1'"); $this->assertEquals(1, count($a_pages)); }