-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make internal Comparator methods protected #5652
Conversation
public function testCompareForeignKeyRestrictNoActionAreTheSame(): void | ||
{ | ||
$fk1 = new ForeignKeyConstraint(['foo'], 'bar', ['baz'], 'fk1', ['onDelete' => 'NO ACTION']); | ||
$fk2 = new ForeignKeyConstraint(['foo'], 'bar', ['baz'], 'fk1', ['onDelete' => 'RESTRICT']); | ||
|
||
self::assertFalse($this->comparator->diffForeignKey($fk1, $fk2)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test has been reworked into ForeignKeyConstraintTest::testCompareRestrictAndNoActionAreTheSame()
.
public function testCompareForeignKeyNamesUnqualifiedAsNoSchemaInformationIsAvailable(): void | ||
{ | ||
$fk1 = new ForeignKeyConstraint(['foo'], 'foo.bar', ['baz'], 'fk1'); | ||
$fk2 = new ForeignKeyConstraint(['foo'], 'baz.bar', ['baz'], 'fk1'); | ||
|
||
self::assertFalse($this->comparator->diffForeignKey($fk1, $fk2)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is supposed to cover the fix (411d38f) for #1694 (I can't really find much about the actual issue).
This is obviously a hack. From the issue description:
[...] all foreign keys in non standard schema all always different, because table1 doesn't contain a schema name in it but table2 does.
The fact that the schema name of the foreign key is unavailable during schema comparison is a flaw in the API, and doesn't mean that any two foreign with the same name from different schemas are the same key.
The fix doesn't take into account the fact that a quoted name can contain a dot.
While we're keeping the code, I'll remove this test as not worth reworking.
public function testCompareQuotedAndUnquotedForeignKeyColumns(): void | ||
{ | ||
$fk1 = new ForeignKeyConstraint(['foo'], 'bar', ['baz'], 'fk1', ['onDelete' => 'NO ACTION']); | ||
$fk2 = new ForeignKeyConstraint(['`foo`'], 'bar', ['`baz`'], 'fk1', ['onDelete' => 'NO ACTION']); | ||
|
||
$diff = $this->comparator->diffForeignKey($fk1, $fk2); | ||
|
||
self::assertFalse($diff); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assumptions under this test are invalid. Quoted and unquoted names may not be equal depending on the platform. This test cannot be reworked with a functional one.
No description provided.