summaryrefslogtreecommitdiff
path: root/tests/Unit/Helpers/Stub
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Helpers/Stub')
-rw-r--r--tests/Unit/Helpers/Stub/UserModelImplementation.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/Unit/Helpers/Stub/UserModelImplementation.php b/tests/Unit/Helpers/Stub/UserModelImplementation.php
index 934aaeb2..1b14a17e 100644
--- a/tests/Unit/Helpers/Stub/UserModelImplementation.php
+++ b/tests/Unit/Helpers/Stub/UserModelImplementation.php
@@ -3,6 +3,7 @@
namespace Engelsystem\Test\Unit\Helpers\Stub;
use Engelsystem\Models\User\User;
+use Illuminate\Database\Eloquent\Collection;
use InvalidArgumentException;
class UserModelImplementation extends User
@@ -13,6 +14,9 @@ class UserModelImplementation extends User
/** @var int */
public static $id = null;
+ /** @var int */
+ public static $apiKey = null;
+
/**
* @param mixed $id
* @param array $columns
@@ -26,4 +30,17 @@ class UserModelImplementation extends User
return self::$user;
}
+
+ /**
+ * @param string $apiKey
+ * @return User[]|Collection|\Illuminate\Database\Query\Builder
+ */
+ public static function whereApiKey($apiKey)
+ {
+ if ($apiKey != static::$apiKey) {
+ throw new InvalidArgumentException('Wrong api key searched');
+ }
+
+ return new Collection([self::$user]);
+ }
}