Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allows testing hasOne relation #7

Merged
merged 1 commit into from
Aug 23, 2024
Merged

Allows testing hasOne relation #7

merged 1 commit into from
Aug 23, 2024

Conversation

edersoares
Copy link
Owner

Adds toHaveHasOneRelation() method.

class Post extends Model
{
   // ..
    public function latestComment(): HasOne
    {
        return $this->hasOne(Comment::class);
    }
   // ..
}


describe('Relation', function () {
    beforeEach()->eloquent(Post::class);

    test()->toHaveHasOneRelation(Comment::class, 'latestComment');
});

@edersoares edersoares merged commit 4531d2c into 2.x Aug 23, 2024
28 checks passed
@edersoares edersoares deleted the has-one branch August 23, 2024 20:48
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant