2018-10-08 19:30:37 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Engelsystem\Test\Unit\Helpers\Stub;
|
|
|
|
|
|
|
|
use Engelsystem\Models\User\User;
|
2018-10-11 01:26:34 +02:00
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
2018-10-08 19:30:37 +02:00
|
|
|
use InvalidArgumentException;
|
|
|
|
|
|
|
|
class UserModelImplementation extends User
|
|
|
|
{
|
|
|
|
/** @var User */
|
|
|
|
public static $user = null;
|
|
|
|
|
|
|
|
/** @var int */
|
|
|
|
public static $id = null;
|
|
|
|
|
2018-10-11 01:26:34 +02:00
|
|
|
/** @var int */
|
|
|
|
public static $apiKey = null;
|
|
|
|
|
2018-10-08 19:30:37 +02:00
|
|
|
/**
|
|
|
|
* @param mixed $id
|
|
|
|
* @param array $columns
|
|
|
|
* @return User|null
|
|
|
|
*/
|
|
|
|
public static function find($id, $columns = ['*'])
|
|
|
|
{
|
|
|
|
if ($id != static::$id) {
|
|
|
|
throw new InvalidArgumentException('Wrong user ID searched');
|
|
|
|
}
|
|
|
|
|
|
|
|
return self::$user;
|
|
|
|
}
|
2018-10-11 01:26:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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]);
|
|
|
|
}
|
2018-10-08 19:30:37 +02:00
|
|
|
}
|