Пример #1
0
 protected function getDifference()
 {
     $from = Container::getSchema();
     $to = Container::getModifiedSchema();
     $diffTool = getApplication()->getManager()->create("\\Migration\\Diff", array('from' => $from, 'to' => $to));
     return $diffTool->getDiff();
 }
Пример #2
0
 public function testDifference()
 {
     $from = Container::getSchema();
     $to = Container::getModifiedSchema();
     $diffTool = getApplication()->getManager()->create("\\Migration\\Diff", array('from' => $from, 'to' => $to));
     $difference = $diffTool->getDiff();
     $this->assertEquals(Container::getCorrectDifference(), $difference);
 }
Пример #3
0
 public function testRemoveModel()
 {
     $schema = Container::getSchema();
     $moduleModel = $schema->getModel('module');
     $this->assertNotNull($moduleModel);
     $schema->removeModel('module');
     $models = $schema->getModels();
     $this->assertArrayNotHasKey('module', $models);
 }
Пример #4
0
 public function testGetSetPK()
 {
     $schema = Container::getSchema();
     $person = $schema->getModel('person');
     $idealPk = array('id_person', 'v_end');
     $this->assertEquals($idealPk, $person->getPrimaryKey());
     // Delete from property method
     $vEnd = $person->getProperty('v_end');
     $vEnd->setPrimary(false);
     $this->assertArrayNotHasKey('v_end', $person->getPrimaryKey());
     // Add from model method
     $person->setPrimaryKey(array('id_person', 'login'));
     $idealPk = array('id_person', 'login');
     $this->assertEquals($idealPk, $person->getPrimaryKey());
 }