Skip to content

Commit

Permalink
fix cs and stan, use legacy mockery syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Oitzinger <tobiasoitzinger@gmail.com>
  • Loading branch information
toitzi committed Sep 27, 2024
1 parent f54b2c7 commit aa5d876
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tests/Laravel/Metadata/VisibleHiddenAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use PHPUnit\Framework\TestCase;
use ReflectionMethod;

/**
* @author Tobias Oitzinger <tobiasoitzinger@gmail.com>
Expand Down Expand Up @@ -99,18 +98,14 @@ public function roles(): HasMany
}
};

$relation->allows([
'getRelated' => $model,
'getForeignKeyName' => 'post_id',
]);
$relation->shouldReceive('getRelated')->andReturn($model);
$relation->shouldReceive('getForeignKeyName')->andReturn('post_id');

$relation2->allows([
'getRelated' => $model,
'getForeignKeyName' => 'role_id',
]);
$relation2->shouldReceive('getRelated')->andReturn($model);
$relation2->shouldReceive('getForeignKeyName')->andReturn('role_id');

// Mock the ReflectionMethod to return `false` for getFileName to avoid file reading.
$reflectionMock = \Mockery::mock(ReflectionMethod::class)->makePartial();
$reflectionMock = \Mockery::mock(\ReflectionMethod::class)->makePartial();
$reflectionMock->allows('getFileName')->andReturn(false);

Check failure on line 109 in tests/Laravel/Metadata/VisibleHiddenAttributesTest.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Call to an undefined method Mockery\LegacyMockInterface::allows().

$relations = $this->modelMetadata->getRelations($model);
Expand Down

0 comments on commit aa5d876

Please sign in to comment.