Skip to content

Commit

Permalink
add all callable forms
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin committed Dec 22, 2024
1 parent 39ea49b commit 7ea9a92
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/Database/Concerns/HasRelationshipsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,20 @@ public function testHasRelation()
$this->assertFalse($author->hasRelation('invalid'));
}

public function testDynamicRelationMethod()
public function testDynamicRelationMethods()
{
$author = new Author();

$author->addDynamicMethod('dynamicMethodAsClosure', function () {
});
$author->addDynamicMethod('dynamicClassMethod', [$author, 'isDatabaseReady']);
$author->addDynamicMethod('dynamicStaticClassMethod', 'Author::hasDatabaseTable');
$author->addDynamicMethod('dynamicClassMethodFromArray', [$author, 'isDatabaseReady']);
$author->addDynamicMethod('dynamicStaticClassMethodFromArray', [Author::class, 'hasDatabaseTable']);

$this->assertFalse($author->hasRelation('dynamicMethodAsClosure'));
$this->assertFalse($author->hasRelation('dynamicClassMethod'));
$this->assertFalse($author->hasRelation('dynamicStaticClassMethod'));
$this->assertFalse($author->hasRelation('dynamicClassMethodFromArray'));
$this->assertFalse($author->hasRelation('dynamicStaticClassMethodFromArray'));
}

public function testGetRelationType()
Expand Down

0 comments on commit 7ea9a92

Please sign in to comment.