本文整理汇总了PHP中Printer::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Printer::find方法的具体用法?PHP Printer::find怎么用?PHP Printer::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Printer
的用法示例。
在下文中一共展示了Printer::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePrinterFromNetdiscovery
/**
* @test
*/
public function updatePrinterFromNetdiscovery()
{
global $DB;
$DB->connect();
$pfCNetworkDiscovery = new PluginFusioninventoryCommunicationNetworkDiscovery();
$GLPIlog = new GLPIlogs();
$networkName = new NetworkName();
$iPAddress = new IPAddress();
$_SESSION['SOURCE_XMLDEVICE'] = array('AUTHSNMP' => '1', 'DESCRIPTION' => 'Photosmart D7200 series', 'ENTITY' => '0', 'FIRMWARE' => '', 'IP' => '192.168.20.102', 'MAC' => '00:21:5a:0b:bb:c4', 'MANUFACTURER' => 'Hewlett-Packard', 'MODEL' => '', 'MODELSNMP' => 'Printer0093', 'NETBIOSNAME' => 'HP00215A0BBBC4', 'SERIAL' => 'MY89AQG0V9050N', 'SNMPHOSTNAME' => 'HP0BBBC4new', 'TYPE' => 'PRINTER');
$printer = new Printer();
$a_printers = $printer->find("`serial`='MY89AQG0V9050N'");
$a_printer = current($a_printers);
$printers_id = $a_printer['id'];
$printer->getFromDB($printers_id);
$pfCNetworkDiscovery->importDevice($printer);
$GLPIlog->testSQLlogs();
$GLPIlog->testPHPlogs();
$printer->getFromDB($printers_id);
$this->assertEquals('HP0BBBC4new', $printer->fields['name'], 'Name must be updated');
$a_printerextends = getAllDatasFromTable('glpi_plugin_fusioninventory_printers', "`printers_id`='" . $printers_id . "'");
$this->assertEquals('1', count($a_printerextends), 'May have one printer extend line for this printer');
$a_printerextend = current($a_printerextends);
$this->assertEquals('1', $a_printerextend['plugin_fusioninventory_configsecurities_id'], 'SNMPauth may be with id 1');
$this->assertEquals('Photosmart D7200 series', $a_printerextend['sysdescr'], 'Sysdescr not updated correctly');
// Check mac
$networkPort = new NetworkPort();
$a_ports = $networkPort->find("`itemtype`='Printer' AND `items_id`='" . $printers_id . "'");
$this->assertEquals('1', count($a_ports), 'May have one network port');
$a_port = current($a_ports);
$this->assertEquals('00:21:5a:0b:bb:c4', $a_port['mac'], 'Mac address');
// check ip
$a_networknames = $networkName->find("`itemtype`='NetworkPort'\n AND `items_id`='" . $a_port['id'] . "'");
$this->assertEquals('1', count($a_networknames), 'May have one networkname');
$a_networkname = current($a_networknames);
$a_ipaddresses = $iPAddress->find("`itemtype`='NetworkName'\n AND `items_id`='" . $a_networkname['id'] . "'");
$this->assertEquals('1', count($a_ipaddresses), 'May have one IP address');
$a_ipaddress = current($a_ipaddresses);
$this->assertEquals('192.168.20.102', $a_ipaddress['name'], 'IP address');
}
示例2: PrinterDiscoveryImportDenied
/**
* @test
*/
public function PrinterDiscoveryImportDenied()
{
global $DB;
$DB->connect();
$a_inventory = array('AUTHSNMP' => '1', 'DESCRIPTION' => 'Brother NC-6400h, Firmware Ver.1.11 (06.12.20),MID 84UZ92', 'ENTITY' => '0', 'FIRMWARE' => '', 'IP' => '10.36.4.29', 'MAC' => '00:80:77:d9:51:c3', 'MANUFACTURER' => 'Brother', 'MODEL' => '', 'MODELSNMP' => 'Printer0442', 'NETBIOSNAME' => 'UH4DLPT01', 'SERIAL' => 'E8J596100A', 'SNMPHOSTNAME' => 'UH4DLPT01', 'TYPE' => 'PRINTER');
$pfCommunicationNetworkDiscovery = new PluginFusioninventoryCommunicationNetworkDiscovery();
$printer = new Printer();
$_SESSION['plugin_fusinvsnmp_taskjoblog']['taskjobs_id'] = 1;
$_SESSION['plugin_fusinvsnmp_taskjoblog']['items_id'] = '1';
$_SESSION['plugin_fusinvsnmp_taskjoblog']['itemtype'] = 'Printer';
$_SESSION['plugin_fusinvsnmp_taskjoblog']['state'] = 0;
$_SESSION['plugin_fusinvsnmp_taskjoblog']['comment'] = '';
$pfCommunicationNetworkDiscovery->sendCriteria($a_inventory);
$a_printers = $printer->find();
$this->assertEquals(0, count($a_printers), 'May have only one Printer');
$pfTaskjoblog = new PluginFusioninventoryTaskjoblog();
$a_logs = $pfTaskjoblog->find("`comment` LIKE '%importdenied%'", '`id` DESC', 1);
$a_log = current($a_logs);
$this->assertEquals('==importdenied== [serial]:E8J596100A, ' . '[mac]:00:80:77:d9:51:c3, [ip]:10.36.4.29, [model]:Printer0442, ' . '[name]:UH4DLPT01, [entities_id]:0, [itemtype]:Printer', $a_log['comment'], 'Import denied message');
}