本文整理汇总了PHP中AuditEvent::getCount方法的典型用法代码示例。如果您正苦于以下问题:PHP AuditEvent::getCount方法的具体用法?PHP AuditEvent::getCount怎么用?PHP AuditEvent::getCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuditEvent
的用法示例。
在下文中一共展示了AuditEvent::getCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$user = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = $user;
$user = new User();
$user->username = 'jimmy';
$user->firstName = 'James';
$user->lastName = 'Boondog';
assert($user->save());
// Not Coding Standard
assert(AuditEvent::getCount() == 4);
// Not Coding Standard
}
示例2: testChangingContactWithoutChangingRelatedAccountShouldNotAuditAccountChangeWhenDoneViaPost
public function testChangingContactWithoutChangingRelatedAccountShouldNotAuditAccountChangeWhenDoneViaPost()
{
Yii::app()->user->userModel = User::getByUsername('super');
$contactStates = ContactState::getByName('Qualified');
$contact = new Contact();
$contact->owner = Yii::app()->user->userModel;
$contact->title->value = 'Mr.';
$contact->firstName = 'Supero';
$contact->lastName = 'Mano';
$contact->state = $contactStates[0];
$this->assertTrue($contact->save());
$beforeCount = AuditEvent::getCount();
//Test that saving an existing contact without a related contact will not produce an audit event showing the
//related account has changed. This is a test to show when the account is not populated but has a negative
//id.
$contactId = $contact->id;
$contact->forget();
unset($contact);
$contact = Contact::getById($contactId);
$fakePostData = array('account' => array('id' => ''));
$contact->setAttributes($fakePostData);
$this->assertTrue($contact->save());
$this->assertEquals($beforeCount, AuditEvent::getCount());
}
示例3: testLogAuditEventForEachType
public function testLogAuditEventForEachType()
{
Yii::app()->user->userModel = User::getByUsername('jimmy');
$beforeCount = AuditEvent::getCount();
$item = new AuditTestItem();
$this->assertTrue($item->save());
$this->assertEquals($beforeCount + 1, AuditEvent::getCount());
$auditEvents = AuditEvent::getTailEvents(1);
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Created, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\)/', ZurmoModule::stringifyAuditEvent($auditEvents[0]));
$item->dateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 120);
$item->date = '2010-12-20';
$item->float = 3.14159;
$item->integer = 666;
$item->time = '11:59';
$this->assertTrue($item->save());
$this->assertEquals($beforeCount + 6, AuditEvent::getCount());
$auditEvents = AuditEvent::getTailEvents(5);
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Date Time from \\(None\\) to [0-9]+/', ZurmoModule::stringifyAuditEvent($auditEvents[0]));
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Date from \\(None\\) to 2010-12-20/', ZurmoModule::stringifyAuditEvent($auditEvents[1]));
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Float from \\(None\\) to 3.14159/', ZurmoModule::stringifyAuditEvent($auditEvents[2]));
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Integer from \\(None\\) to 666/', ZurmoModule::stringifyAuditEvent($auditEvents[3]));
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Time from \\(None\\) to 11:59/', ZurmoModule::stringifyAuditEvent($auditEvents[4]));
$item->dateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$item->date = '2012-01-22';
$item->float = 6.626068E-34;
$item->integer = 69;
$item->time = '12:00';
$this->assertTrue($item->save());
$this->assertEquals($beforeCount + 11, AuditEvent::getCount());
$auditEvents = AuditEvent::getTailEvents(5);
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Date from 2010-12-20 to 2012-01-22/', ZurmoModule::stringifyAuditEvent($auditEvents[1]));
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Float from 3.14159 to 6.626068E-34/', ZurmoModule::stringifyAuditEvent($auditEvents[2]));
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Integer from 666 to 69/', ZurmoModule::stringifyAuditEvent($auditEvents[3]));
$this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'AuditTestItem\\([0-9]+\\), \\(None\\), ' . 'Changed Time from 11:59 to 12:00/', ZurmoModule::stringifyAuditEvent($auditEvents[4]));
}