improved tenant identification

This commit is contained in:
Denis Duliçi
2021-04-16 00:59:43 +03:00
parent 9635e6be5d
commit 2b07442260
126 changed files with 1719 additions and 999 deletions

View File

@ -4,8 +4,7 @@ namespace Tests\Feature;
use App\Models\Auth\User;
use App\Models\Common\Company;
use App\Utilities\Overrider;
use Faker\Factory;
use Faker\Factory as Faker;
use Tests\TestCase;
abstract class FeatureTestCase extends TestCase
@ -22,14 +21,14 @@ abstract class FeatureTestCase extends TestCase
$this->withoutExceptionHandling();
$this->faker = Factory::create();
$this->faker = Faker::create();
$this->user = User::first();
$this->company = $this->user->companies()->first();
// Disable debugbar
config(['debugbar.enabled', false]);
Overrider::load('currencies');
app('url')->defaults(['company_id' => $this->company->id]);
}
/**
@ -45,13 +44,13 @@ abstract class FeatureTestCase extends TestCase
$user = $this->user;
}
if (!$company) {
$company = $this->company;
if ($company) {
$company->makeCurrent();
app('url')->defaults(['company_id' => $company->id]);
}
$this->startSession();
return $this->actingAs($user)->withSession(['company_id' => $company->id]);
return $this->actingAs($user);
}
public function assertFlashLevel($excepted)