Example #1
0
 public function testTypeFails()
 {
     $this->setExpectedException('Doctrine\\DBAL\\DBALException');
     $adminModel = $this->personRepository->create(array('login' => 'admin', 'salt' => '123', 'hash' => crypt('123', '123'), 'status' => 'Only_one_char_can_be_in_that_string'));
     $adminModel->save();
     \DatabaseManager::clearTables();
 }
Example #2
0
 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();
 }