mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
587234f205
updated jwt kernel from getuserfromtoken to autenticate updated verify response from data.token to token updated user factory changed routes for update user profile to from PUT to PATCH added register with actingAs user added test update freightforwarder user added test update importer user
31 lines
869 B
PHP
31 lines
869 B
PHP
<?php
|
|
|
|
namespace Tests;
|
|
|
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Contracts\Auth\Authenticatable as UserContract;
|
|
use App\User;
|
|
|
|
abstract class TestCase extends BaseTestCase
|
|
{
|
|
use RefreshDatabase;
|
|
use CreatesApplication;
|
|
protected $user;
|
|
|
|
public function actingAs(UserContract $user, $driver = null)
|
|
{
|
|
$this->user = $user;
|
|
return $this;
|
|
}
|
|
|
|
public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
|
|
{
|
|
if ($this->user) {
|
|
$server['HTTP_AUTHORIZATION'] = 'Bearer ' . \JWTAuth::fromUser($this->user);
|
|
}
|
|
$server['HTTP_ACCEPT'] = 'application/json';
|
|
return parent::call($method, $uri, $parameters, $cookies, $files, $server, $content);
|
|
}
|
|
}
|