本文整理匯總了PHP中Alert::alertExists方法的典型用法代碼示例。如果您正苦於以下問題:PHP Alert::alertExists方法的具體用法?PHP Alert::alertExists怎麽用?PHP Alert::alertExists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Alert
的用法示例。
在下文中一共展示了Alert::alertExists方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testAddDelete
public function testAddDelete()
{
$alert = new Alert();
$nb = countElementsInTable($alert->getTable());
$comp = getItemByTypeName('Computer', '_test_pc01');
$date = '2016-09-01 12:34:56';
// Add
$id = $alert->add(['itemtype' => $comp->getType(), 'items_id' => $comp->getID(), 'type' => Alert::END, 'date' => $date]);
$this->assertGreaterThan(0, $id);
$this->assertGreaterThan($nb, countElementsInTable($alert->getTable()));
// Getters
$this->assertFalse(Alert::alertExists($comp->getType(), $comp->getID(), Alert::NOTICE));
$this->assertEquals($id, Alert::alertExists($comp->getType(), $comp->getID(), Alert::END));
$this->assertEquals($date, Alert::getAlertDate($comp->getType(), $comp->getID(), Alert::END));
// Delete
$this->assertTrue($alert->clear($comp->getType(), $comp->getID(), Alert::END));
$this->assertEquals($nb, countElementsInTable($alert->getTable()));
// Still true, nothing to delete but no error
$this->assertTrue($alert->clear($comp->getType(), $comp->getID(), Alert::END));
}