本文整理汇总了PHP中AuditEvent::deleteAll方法的典型用法代码示例。如果您正苦于以下问题:PHP AuditEvent::deleteAll方法的具体用法?PHP AuditEvent::deleteAll怎么用?PHP AuditEvent::deleteAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuditEvent
的用法示例。
在下文中一共展示了AuditEvent::deleteAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLogAuditEventsForIsActive
public function testLogAuditEventsForIsActive()
{
$user = new User();
$user->username = 'testlogauditforisactive';
$user->title->value = 'Mr.';
$user->firstName = 'My';
$user->lastName = 'testlogauditforisactive';
$user->setPassword('testlogauditforisactive');
$this->assertTrue($user->save());
unset($user);
$user = User::getByUsername('testlogauditforisactive');
$this->assertEquals(1, $user->isActive);
unset($user);
AuditEvent::deleteAll();
//Change the user's status to inactive and confirm new audit event is created
$user = User::getByUsername('testlogauditforisactive');
$user->setRight('UsersModule', UsersModule::RIGHT_LOGIN_VIA_WEB, RIGHT::DENY);
$this->assertTrue($user->save());
$this->assertEquals(0, $user->isActive);
$auditEvents = AuditEvent::getAll();
$this->assertCount(1, $auditEvents);
$this->assertContains('Item Modified', strval($auditEvents[0]));
unset($user);
//Now change the user's status back to active and confirm new audit event is created
$user = User::getByUsername('testlogauditforisactive');
$user->setRight('UsersModule', UsersModule::RIGHT_LOGIN_VIA_WEB, RIGHT::ALLOW);
$this->assertTrue($user->save());
$this->assertEquals(1, $user->isActive);
$auditEvents = AuditEvent::getAll();
$this->assertCount(2, $auditEvents);
$this->assertContains('Item Modified', strval($auditEvents[1]));
unset($user);
}