Skip to content
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

Add tests to cover morphTo with hybrid MongoDB and SQL #2671

Closed
wants to merge 1 commit into from

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Nov 8, 2023

Follow #2669

Add tests for SQL model to MongoDB model morph relation in both directions.

In tests, I rename SQL tables to singular (common practice) to ensure we don't mess with collection name of similar models. It helps when debugging.

@GromNaN GromNaN force-pushed the tests-hybrid-morph branch from a007539 to 8c353c1 Compare November 8, 2023 12:12
$photo->save();
$photo = $user->photos()->save($photo);

$this->assertEquals(1, $user->photos->count());
Copy link
Member Author

@GromNaN GromNaN Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fails here:

Failed asserting that 0 matches expected 1.

But this error seems to come from Laravel itself: if I replace User with SqlUser and remove the HybridRelations trait from every Sql model, it still fails. I may have an error in the model definition.

@GromNaN GromNaN closed this Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant