request = m::mock(Request::class); $this->request->attributes = new ParameterBag(); } /** * Set a request attribute on the mock object. * * @param string $attribute * @param mixed $value */ protected function setRequestAttribute(string $attribute, $value) { $this->request->attributes->set($attribute, $value); } /** * Sets the mocked request user. If a user model is not provided, a factory model * will be created and returned. * * @param \Pterodactyl\Models\User|null $user * @return \Pterodactyl\Models\User */ protected function setRequestUser(User $user = null): User { $user = $user instanceof User ? $user : factory(User::class)->make(); $this->request->shouldReceive('user')->withNoArgs()->andReturn($user); return $user; } }