protected function getDifference() { $from = Container::getSchema(); $to = Container::getModifiedSchema(); $diffTool = getApplication()->getManager()->create("\\Migration\\Diff", array('from' => $from, 'to' => $to)); return $diffTool->getDiff(); }
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); }
public function testRemoveModel() { $schema = Container::getSchema(); $moduleModel = $schema->getModel('module'); $this->assertNotNull($moduleModel); $schema->removeModel('module'); $models = $schema->getModels(); $this->assertArrayNotHasKey('module', $models); }
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()); }