本文整理汇总了PHP中DatabaseManager::generateFakeRecords方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseManager::generateFakeRecords方法的具体用法?PHP DatabaseManager::generateFakeRecords怎么用?PHP DatabaseManager::generateFakeRecords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager::generateFakeRecords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDelete
public function testDelete()
{
/**
* Log models delete test
*/
\DatabaseManager::generateFakeRecords();
$admin = $this->personRepository->findOne(array('login' => 'admin'));
$admin->delete();
$map = $this->getRepositoryMap($this->personRepository);
$this->assertCount(0, $map);
$rows = $this->dbal->fetchAll("select * from person where login = 'admin'");
$this->assertCount(1, $rows);
$adminRow = $rows[0];
$this->assertLessThanOrEqual(time(), strtotime($adminRow['v_end']));
/**
* Delete test for model without log behaviour
*/
$newModule = $this->moduleRepository->create(array('name' => 'Name'));
$newModule->save();
$map = $this->getRepositoryMap($this->moduleRepository);
$this->assertCount(1, $map);
$newModule->delete();
$map = $this->getRepositoryMap($this->moduleRepository);
$this->assertCount(0, $map);
$rows = $this->dbal->fetchAll("select * from module");
$this->assertCount(1, $rows);
// there is 1 backend module
\DatabaseManager::clearTables();
}
示例2: testManyToManyDelete
public function testManyToManyDelete()
{
\DatabaseManager::generateFakeRecords();
$admin = $this->personRepository->findOne(array('login' => 'admin'));
$backend = $this->moduleRepository->findOne(array('name' => 'Backend'));
$admin->addModuleDeveloperLink($backend);
$links = $admin->getModuleDeveloperLinks();
$this->assertCount(1, $links);
$link = $links[0];
$link->delete();
$links = $admin->getModuleDeveloperLinks();
$this->assertCount(0, $links);
$rows = $this->dbal->fetchAll("select * from module_developer_link");
$this->assertCount(1, $rows);
$now = $this->dbal->fetchNow();
$this->assertLessThanOrEqual(strtotime($now), $rows[0]['v_end']);
\DatabaseManager::clearTables();
}