Esempio n. 1
0
 function testForeignKey()
 {
     $m = $this->getManager('test_');
     $a = new Schema($m);
     $a->setTable('authors');
     $a->addId();
     $a->addChar('name');
     $name = 'authors';
     $res = $a->makeMigration($name);
     $s = new Schema($m);
     $s->setTable('books');
     $s->addId()->addInt('author_id')->addForeignKey('author_id', $a, null, Schema::FK_RESTRICT, Schema::FK_CASCADE);
     $exp = file_get_contents($this->temp . '/MigrationForeignKey.php');
     $name = 'foreign_key';
     $res = $s->makeMigration($name);
     //    file_put_contents($this->temp . '/MigrationForeignKey.php', $s->makeMigration($name));
     $this->assertEquals($exp, $res, 'Внешний ключ');
 }