From e653387f1db77a559d723c46a05b4c9492614c5b Mon Sep 17 00:00:00 2001 From: Niclas Schirrmeister Date: Tue, 4 Aug 2020 17:30:01 +0200 Subject: [PATCH 1/2] fix array_diff --- src/PHPUnit/Assertions/ModelAssertions.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PHPUnit/Assertions/ModelAssertions.php b/src/PHPUnit/Assertions/ModelAssertions.php index 949449f..ee21996 100644 --- a/src/PHPUnit/Assertions/ModelAssertions.php +++ b/src/PHPUnit/Assertions/ModelAssertions.php @@ -3,7 +3,6 @@ namespace Elbgoods\CiTestTools\PHPUnit\Assertions; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Arr; use PHPUnit\Framework\Assert as PHPUnit; trait ModelAssertions @@ -23,7 +22,7 @@ public static function assertEqualsModel(Model $expected, $actual, ?string $mess PHPUnit::assertTrue($expected->is($actual)); } - foreach (Arr::except($expected->getFillable(), $expected->getHidden()) as $attribute) { + foreach (arr_diff($expected->getFillable(), $expected->getHidden()) as $attribute) { PHPUnit::assertEquals( $expected->getAttribute($attribute), data_get($actual, $attribute), From 4dc471dbc7624f5c76dcbcfef2bb7fce4ac647c3 Mon Sep 17 00:00:00 2001 From: eisfeuer Date: Tue, 4 Aug 2020 17:32:03 +0200 Subject: [PATCH 2/2] Update ModelAssertions.php --- src/PHPUnit/Assertions/ModelAssertions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PHPUnit/Assertions/ModelAssertions.php b/src/PHPUnit/Assertions/ModelAssertions.php index ee21996..824e7cf 100644 --- a/src/PHPUnit/Assertions/ModelAssertions.php +++ b/src/PHPUnit/Assertions/ModelAssertions.php @@ -22,7 +22,7 @@ public static function assertEqualsModel(Model $expected, $actual, ?string $mess PHPUnit::assertTrue($expected->is($actual)); } - foreach (arr_diff($expected->getFillable(), $expected->getHidden()) as $attribute) { + foreach (array_diff($expected->getFillable(), $expected->getHidden()) as $attribute) { PHPUnit::assertEquals( $expected->getAttribute($attribute), data_get($actual, $attribute),