Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/izyim-api into asif/contact

# Conflicts:
#	Dockerfile
#	app/Company.php
#	app/Http/Controllers/CompanyController.php
#	app/Http/Kernel.php
#	app/User.php
#	composer.json
#	composer.lock
#	config/app.php
#	package-lock.json
#	routes/api.php
#	tests/TestCase.php
This commit is contained in:
Aqeeb Imtiaz Harun
2018-06-12 09:28:51 +08:00
102 changed files with 17157 additions and 14407 deletions
+20
View File
@@ -3,9 +3,13 @@
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 function headers($user = null)
@@ -15,4 +19,20 @@ abstract class TestCase extends BaseTestCase
return $headers;
}
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);
}
}