Skip to content

Commit 08d9140

Browse files
EdaCZdg
authored andcommitted
Structure tests: driver should return also name of foreign key constraint
1 parent 555fe2b commit 08d9140

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/Database/Structure.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ class StructureTestCase extends TestCase
8282
$this->connection->shouldReceive('getSupplementalDriver')->times(4)->andReturn($this->driver);
8383
$this->driver->shouldReceive('getForeignKeys')->with('authors')->once()->andReturn([]);
8484
$this->driver->shouldReceive('getForeignKeys')->with('Books')->once()->andReturn([
85-
['local' => 'author_id', 'table' => 'authors', 'foreign' => 'id'],
86-
['local' => 'translator_id', 'table' => 'authors', 'foreign' => 'id'],
85+
['local' => 'author_id', 'table' => 'authors', 'foreign' => 'id', 'name' => 'authors_fk1'],
86+
['local' => 'translator_id', 'table' => 'authors', 'foreign' => 'id', 'name' => 'authors_fk2'],
8787
]);
8888
$this->driver->shouldReceive('getForeignKeys')->with('tags')->once()->andReturn([]);
8989
$this->driver->shouldReceive('getForeignKeys')->with('books_x_tags')->once()->andReturn([
90-
['local' => 'book_id', 'table' => 'Books', 'foreign' => 'id'],
91-
['local' => 'tag_id', 'table' => 'tags', 'foreign' => 'id'],
90+
['local' => 'book_id', 'table' => 'Books', 'foreign' => 'id', 'name' => 'books_x_tags_fk1'],
91+
['local' => 'tag_id', 'table' => 'tags', 'foreign' => 'id', 'name' => 'books_x_tags_fk2'],
9292
]);
9393

9494
$this->structure = new StructureMock($this->connection, $this->storage);

tests/Database/Structure.schemas.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ class StructureSchemasTestCase extends TestCase
6868
$this->connection->shouldReceive('getSupplementalDriver')->times(2)->andReturn($this->driver);
6969
$this->driver->shouldReceive('getForeignKeys')->with('authors.authors')->once()->andReturn([]);
7070
$this->driver->shouldReceive('getForeignKeys')->with('books.books')->once()->andReturn([
71-
['local' => 'author_id', 'table' => 'authors.authors', 'foreign' => 'id'],
72-
['local' => 'translator_id', 'table' => 'authors.authors', 'foreign' => 'id'],
71+
['local' => 'author_id', 'table' => 'authors.authors', 'foreign' => 'id', 'name' => 'authors_authors_fk1'],
72+
['local' => 'translator_id', 'table' => 'authors.authors', 'foreign' => 'id', 'name' => 'authors_authors_fk2'],
7373
]);
7474

7575
$this->structure = new StructureMock($this->connection, $this->storage);

0 commit comments

Comments
 (0)