Astrotomic / phpunit-assertions

This package provides a set of common PHPUnit custom assertions.
MIT License
18 stars 3 forks source link

add model assertion that two models are related #2

Closed Gummibeer closed 3 years ago

Gummibeer commented 3 years ago

solves #1

\Astrotomic\PhpunitAssertions\Laravel\ModelAssertions::assertRelated($post, $comment, 'comments');
\Astrotomic\PhpunitAssertions\Laravel\ModelAssertions::assertRelationship(
    $post, 
    \App\Models\Comment::class, 
    'comments', 
    \Illuminate\Database\Eloquent\Relations\HasMany::class
);
Gummibeer commented 3 years ago

@aidan-casey sorry for the long delay. I've updated the assertion to be able to handle all of our use-cases. Do you want to check it if it's now doing what you wanted?^^

aidan-casey commented 3 years ago

@aidan-casey sorry for the long delay. I've updated the assertion to be able to handle all of our use-cases. Do you want to check it if it's now doing what you wanted?^^

Likewise, sorry for the long delay! What you have here is exactly the functionality I was thinking of. I think it fits the use case well.

Thanks for your work on this!

Gummibeer commented 3 years ago

https://github.com/Astrotomic/phpunit-assertions/releases/tag/0.3.0