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


PHP DatabaseManager::generateFakeRecords方法代码示例

本文整理汇总了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();
 }
开发者ID:cti,项目名称:storage,代码行数:29,代码来源:RepositoryTest.php

示例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();
 }
开发者ID:cti,项目名称:storage,代码行数:18,代码来源:LinkTest.php


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