Skip to content

Commit c86b77e

Browse files
committed
test foreign key with a name
1 parent 3e087f0 commit c86b77e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tests/IndexTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,16 @@ function testForeignKeys(){
191191
$this->assertEquals($tbl['indexes'][0]['ref_cols'], array(array("name" => "f_bar")));
192192
$this->assertEquals($tbl['indexes'][0]['ref_match'], "FULL");
193193
$this->assertEquals($tbl['indexes'][0]['ref_on_delete'], "SET NULL");
194+
195+
$tbl = $this->get_first_table("CREATE TABLE foo (bar INT, FOREIGN KEY bar (qux, `quux`) REFERENCES f_foo (f_bar)");
196+
$this->assertEquals($tbl['indexes'][0]['type'], "FOREIGN");
197+
$this->assertEquals($tbl['indexes'][0]['name'], "bar");
198+
$this->assertEquals($tbl['indexes'][0]['cols'], array(
199+
array("name" => "qux"),
200+
array("name" => "quux"),
201+
));
202+
$this->assertEquals($tbl['indexes'][0]['ref_table'], "f_foo");
203+
$this->assertEquals($tbl['indexes'][0]['ref_cols'], array(array("name" => "f_bar")));
194204
}
195205

196206
function testChecks(){

0 commit comments

Comments
 (0)