-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix tests on Schema index helpers #3236
Conversation
388e5fe
to
31e6efe
Compare
31e6efe
to
58b94c1
Compare
tests/SchemaTest.php
Outdated
Schema::table('newcollection', function ($collection) { | ||
$collection->index(['field_a' => -1, 'field_b' => 1]); | ||
}); | ||
|
||
$index = $this->getIndex('newcollection', 'field_a_-1_field_b_1'); | ||
$index = $this->getIndex('newcollection', $indexName); | ||
$this->assertNotNull($index); |
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.
Here the assertion was always true, $index
was false
for missing index.
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.
Having assertIndexExists()
and assertIndexNotExists()
would make the tests more readable if you wanted to go that route. I realize you can't get rid of getIndex()
entirely, since some later tests expect to make assertions on the IndexInfo structure.
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.
Thanks for the suggestion, that's more explicit with the new assert methods.
Find index by its actual name instead of the key fields.
Fix wrong assertions checking indexes doesn't exist with the wrong name.