Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #30 from elbgoods/feature/disable_consider_hidden_…
Browse files Browse the repository at this point in the history
…attributes

Add option to ignore hidden values
  • Loading branch information
Gummibeer authored Aug 4, 2020
2 parents d860528 + 3380739 commit 9b6c766
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/PHPUnit/Assertions/ModelAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Elbgoods\CiTestTools\PHPUnit\Assertions;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use PHPUnit\Framework\Assert as PHPUnit;

trait ModelAssertions
Expand All @@ -22,7 +23,7 @@ public static function assertEqualsModel(Model $expected, $actual, ?string $mess
PHPUnit::assertTrue($expected->is($actual));
}

foreach ($expected->getFillable() as $attribute) {
foreach (Arr::except($expected->getFillable(), $expected->getHidden()) as $attribute) {
PHPUnit::assertEquals(
$expected->getAttribute($attribute),
data_get($actual, $attribute),
Expand Down

0 comments on commit 9b6c766

Please sign in to comment.