当前位置: 首页>>代码示例>>PHP>>正文


PHP Printer::isDeleted方法代码示例

本文整理汇总了PHP中Printer::isDeleted方法的典型用法代码示例。如果您正苦于以下问题:PHP Printer::isDeleted方法的具体用法?PHP Printer::isDeleted怎么用?PHP Printer::isDeleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Printer的用法示例。


在下文中一共展示了Printer::isDeleted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDelete

 /**
  * @covers Printer::delete
  * @covers Printer::restore
  */
 public function testDelete()
 {
     $obj = new Printer();
     $this->assertTrue($obj->maybeDeleted());
     // Add
     $id = $obj->add(['name' => __METHOD__]);
     $this->assertGreaterThan(0, $id);
     $this->assertTrue($obj->getFromDB($id));
     $this->assertEquals(0, $obj->getField('is_deleted'));
     $this->assertEquals(0, $obj->isDeleted());
     // Delete
     $this->assertTrue($obj->delete(['id' => $id], 0));
     $this->assertTrue($obj->getFromDB($id));
     $this->assertEquals(1, $obj->getField('is_deleted'));
     $this->assertEquals(1, $obj->isDeleted());
     // Restore
     $this->assertTrue($obj->restore(['id' => $id], 0));
     $this->assertTrue($obj->getFromDB($id));
     $this->assertEquals(0, $obj->getField('is_deleted'));
     $this->assertEquals(0, $obj->isDeleted());
     // Purge
     $this->assertTrue($obj->delete(['id' => $id], 1));
     $this->assertFalse($obj->getFromDB($id));
 }
开发者ID:btry,项目名称:glpi,代码行数:28,代码来源:PrinterTest.php

示例2: testDeleteByCriteria

 /**
  * @covers Printer::deleteByCriteria
  * @covers Printer::restore
  */
 public function testDeleteByCriteria()
 {
     $obj = new Printer();
     $this->assertTrue($obj->maybeDeleted());
     // Add
     $id = $obj->add(['name' => __METHOD__, 'entities_id' => getItemByTypeName('Entity', '_test_root_entity', true)]);
     $this->assertGreaterThan(0, $id);
     $this->assertTrue($obj->getFromDB($id));
     $this->assertEquals(0, $obj->getField('is_deleted'));
     $this->assertEquals(0, $obj->isDeleted());
     $nb_before = countElementsInTable('glpi_logs', "itemtype = 'Printer'\n                                          AND items_id = '{$id}'");
     // DeleteByCriteria without history
     $this->assertTrue($obj->deleteByCriteria(['name' => __METHOD__], 0, 0));
     $this->assertTrue($obj->getFromDB($id));
     $this->assertEquals(1, $obj->getField('is_deleted'));
     $this->assertEquals(1, $obj->isDeleted());
     $nb_after = countElementsInTable('glpi_logs', "itemtype = 'Printer'\n                                          AND items_id = '{$id}'");
     $this->assertEquals($nb_before, $nb_after);
     // Restore
     $this->assertTrue($obj->restore(['id' => $id], 0));
     $this->assertTrue($obj->getFromDB($id));
     $this->assertEquals(0, $obj->getField('is_deleted'));
     $this->assertEquals(0, $obj->isDeleted());
     $nb_before = countElementsInTable('glpi_logs', "itemtype = 'Printer'\n                                          AND items_id = '{$id}'");
     // DeleteByCriteria with history
     $this->assertTrue($obj->deleteByCriteria(['name' => __METHOD__], 0, 1));
     $this->assertTrue($obj->getFromDB($id));
     $this->assertEquals(1, $obj->getField('is_deleted'));
     $this->assertEquals(1, $obj->isDeleted());
     $nb_after = countElementsInTable('glpi_logs', "itemtype = 'Printer'\n                                          AND items_id = '{$id}'");
     $this->assertEquals($nb_before + 1, $nb_after);
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:36,代码来源:PrinterTest.php


注:本文中的Printer::isDeleted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。