Skip to content

Commit

Permalink
Merge pull request #3644 from rchavik/3.0-fixture
Browse files Browse the repository at this point in the history
Fix PersonFixture: Not null fields cause duplicates with unique constraints
  • Loading branch information
markstory committed Jun 5, 2014
2 parents fc71b29 + 6004025 commit f03d486
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/Fixture/PersonFixture.php
Expand Up @@ -30,11 +30,11 @@ class PersonFixture extends TestFixture {
public $fields = array(
'id' => ['type' => 'integer', 'null' => false],
'name' => ['type' => 'string', 'null' => false, 'length' => 32],
'mother_id' => ['type' => 'integer', 'null' => false],
'father_id' => ['type' => 'integer', 'null' => false],
'mother_id' => ['type' => 'integer', 'null' => true],
'father_id' => ['type' => 'integer', 'null' => true],
'_constraints' => [
'primary' => ['type' => 'primary', 'columns' => ['id']],
'mother_idx' => ['type' => 'unique', 'columns' => ['mother_id', 'father_id']]
'mother_idx' => ['type' => 'unique', 'columns' => ['mother_id', 'father_id']],
]
);

Expand All @@ -47,9 +47,9 @@ class PersonFixture extends TestFixture {
array('name' => 'person', 'mother_id' => 2, 'father_id' => 3),
array('name' => 'mother', 'mother_id' => 4, 'father_id' => 5),
array('name' => 'father', 'mother_id' => 6, 'father_id' => 7),
array('name' => 'mother - grand mother', 'mother_id' => 0, 'father_id' => 0),
array('name' => 'mother - grand father', 'mother_id' => 0, 'father_id' => 0),
array('name' => 'father - grand mother', 'mother_id' => 0, 'father_id' => 0),
array('name' => 'father - grand father', 'mother_id' => 0, 'father_id' => 0)
array('name' => 'mother - grand mother', 'mother_id' => null, 'father_id' => null),
array('name' => 'mother - grand father', 'mother_id' => null, 'father_id' => null),
array('name' => 'father - grand mother', 'mother_id' => null, 'father_id' => null),
array('name' => 'father - grand father', 'mother_id' => null, 'father_id' => null)
);
}

0 comments on commit f03d486

Please sign in to comment.