Skip to content

5.3 UnitTests #930

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

Merged
merged 9 commits into from
Aug 30, 2016
Merged

5.3 UnitTests #930

merged 9 commits into from
Aug 30, 2016

Conversation

pi0
Copy link
Contributor

@pi0 pi0 commented Aug 29, 2016

I'm working on Unit Tests to be fully passed.

Update: All tests passed!

@pi0 pi0 force-pushed the UnitTests branch 2 times, most recently from 7a330d7 to 1a6f337 Compare August 29, 2016 18:36
@pi0 pi0 force-pushed the UnitTests branch 4 times, most recently from 3238367 to e82ad50 Compare August 29, 2016 20:02
@pi0
Copy link
Contributor Author

pi0 commented Aug 30, 2016

@jenssegers Finally all tests fully passed :) Would you please Review and Approve this PR ?

$relationCount = array_count_values(array_map(function ($id) {
return (string) $id; // Convert Back ObjectIds to Strings
}, $query->pluck($relation->getHasCompareKey())));
}, is_array($relations) ? $relations : $relations->toArray()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests fail without this check:

  • RelationsTest.php:384
  • RelationsTest.php:433

Error: array_map(): Argument #2 should be an array

Laravel has returns arrays instead of Collections!

@jenssegers
Copy link
Contributor

Looking good!

@@ -233,11 +234,11 @@ public function getAttribute($key)

// This attribute matches an embedsOne or embedsMany relation so we need
// to return the relation results instead of the interal attributes.
if ($relations instanceof EmbedsOneOrMany) {
if ($relations instanceof EmbedsOneOrMany or $relations instanceof MorphTo) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems a bit odd, this is very specific to embedded relations, why was MorpTo added here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RelationsTest.php:367 : Failed asserting that null is an instance of class "User".
As a workaround to working MorphTo Relations will be directly returned and resolved.
Is it necessary to separate this logical part?

Copy link
Contributor

Choose a reason for hiding this comment

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

Might be better to split the logic indeed, I'll have to check what exactly is going wrong because this is weird.

@jenssegers
Copy link
Contributor

Let me know when your changes are done!

@pi0
Copy link
Contributor Author

pi0 commented Aug 30, 2016

@jenssegers last commit was due to accidental fast-forward :) if you think something is missing just let me know :)

@jenssegers jenssegers merged commit 296fac2 into mongodb:master Aug 30, 2016
@jenssegers
Copy link
Contributor

Ill release this as an RC and go over everything soon.

mnphpexpert added a commit to mnphpexpert/laravel-mongodb that referenced this pull request Sep 2, 2024
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.

2 participants