/** * Create all of the tables relationships. */ protected function createRelationships() { foreach ($this->table->getRelationships() as $relationship) { $this->content .= " \$table->foreign('{$relationship->tableColumn}')->" . "references('{$relationship->relationshipColumn}')->on('{$relationship->relationshipTable}');\n"; } }
public function testDropRelationship() { $tbl = new Table("test_table", 'MyISAM'); $tbl->addRelationship($this->getMock('Cytracom\\Squasher\\Database\\Relationship', [], ['col_id', 'id', 'other_table'])); $tbl->dropRelationship('test_table_col_id_foreign'); $rels = $tbl->getRelationships(); $this->assertEquals(0, count($rels)); }