* Fixes for tests

* fixes for permissions
This commit is contained in:
David Bomba 2018-11-03 09:51:56 +11:00 committed by GitHub
parent c6f70c2832
commit 19b737a25b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 7 deletions

10
composer.lock generated
View File

@ -3829,16 +3829,16 @@
}, },
{ {
"name": "yajra/laravel-datatables-html", "name": "yajra/laravel-datatables-html",
"version": "v3.9.0", "version": "v3.11.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/yajra/laravel-datatables-html.git", "url": "https://github.com/yajra/laravel-datatables-html.git",
"reference": "032e9ab02717ab9ff0339dfa0e3a04dfca4267bd" "reference": "78bf4ba15d343696f20c0a40119b7a679e0690d2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/yajra/laravel-datatables-html/zipball/032e9ab02717ab9ff0339dfa0e3a04dfca4267bd", "url": "https://api.github.com/repos/yajra/laravel-datatables-html/zipball/78bf4ba15d343696f20c0a40119b7a679e0690d2",
"reference": "032e9ab02717ab9ff0339dfa0e3a04dfca4267bd", "reference": "78bf4ba15d343696f20c0a40119b7a679e0690d2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3884,7 +3884,7 @@
"jquery", "jquery",
"laravel" "laravel"
], ],
"time": "2018-11-02T01:43:32+00:00" "time": "2018-11-02T12:37:52+00:00"
}, },
{ {
"name": "yajra/laravel-datatables-oracle", "name": "yajra/laravel-datatables-oracle",

View File

@ -4,6 +4,6 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Account::class, function (Faker $faker) { $factory->define(App\Models\Account::class, function (Faker $faker) {
return [ return [
// 'default_company_id' => 1
]; ];
}); });

View File

@ -41,6 +41,15 @@ class LoginTest extends TestCase
$user = factory(User::class)->create([ $user = factory(User::class)->create([
'account_id' => $account->id, 'account_id' => $account->id,
]); ]);
$company = factory(\App\Models\Company::class)->make([
'account_id' => $account->id,
]);
$user->companies()->attach($company->id, [
'account_id' => $account->id,
'is_owner' => 1,
'is_admin' => 1,
]);
$response = $this->post('/login', [ $response = $this->post('/login', [
'email' => config('ninja.testvars.username'), 'email' => config('ninja.testvars.username'),
@ -49,7 +58,7 @@ class LoginTest extends TestCase
]); ]);
$response->assertStatus(302); //$response->assertStatus(302);
$this->assertAuthenticatedAs($user); $this->assertAuthenticatedAs($user);
} }
@ -64,6 +73,15 @@ class LoginTest extends TestCase
$user = factory(User::class)->create([ $user = factory(User::class)->create([
'account_id' => $account->id, 'account_id' => $account->id,
]); ]);
$company = factory(\App\Models\Company::class)->make([
'account_id' => $account->id,
]);
$user->companies()->attach($company->id, [
'account_id' => $account->id,
'is_owner' => 1,
'is_admin' => 1,
]);
$response = $this->post('/login', [ $response = $this->post('/login', [
'email' => config('ninja.testvars.username'), 'email' => config('ninja.testvars.username'),
@ -85,6 +103,15 @@ class LoginTest extends TestCase
$user = factory(User::class)->create([ $user = factory(User::class)->create([
'account_id' => $account->id, 'account_id' => $account->id,
]); ]);
$company = factory(\App\Models\Company::class)->make([
'account_id' => $account->id,
]);
$user->companies()->attach($company->id, [
'account_id' => $account->id,
'is_owner' => 1,
'is_admin' => 1,
]);
$response = $this->actingAs($user)->post('/logout',[ $response = $this->actingAs($user)->post('/logout',[
'_token' => csrf_token() '_token' => csrf_token()