tab to space
This commit is contained in:
parent
ad28458b96
commit
7411808d5b
@ -9,63 +9,63 @@ use Tests\TestCase;
|
|||||||
|
|
||||||
abstract class FeatureTestCase extends TestCase
|
abstract class FeatureTestCase extends TestCase
|
||||||
{
|
{
|
||||||
protected $faker;
|
protected $faker;
|
||||||
|
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
protected $company;
|
protected $company;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->withoutExceptionHandling();
|
$this->withoutExceptionHandling();
|
||||||
|
|
||||||
$this->faker = Factory::create();
|
$this->faker = Factory::create();
|
||||||
$this->user = User::first();
|
$this->user = User::first();
|
||||||
$this->company = $this->user->companies()->first();
|
$this->company = $this->user->companies()->first();
|
||||||
|
|
||||||
session(['company_id' => $this->company->id]);
|
session(['company_id' => $this->company->id]);
|
||||||
|
|
||||||
// Set Company settings
|
// Set Company settings
|
||||||
setting()->setExtraColumns(['company_id' => $this->company->id]);
|
setting()->setExtraColumns(['company_id' => $this->company->id]);
|
||||||
setting()->forgetAll();
|
setting()->forgetAll();
|
||||||
setting()->load(true);
|
setting()->load(true);
|
||||||
|
|
||||||
// Disable debugbar
|
// Disable debugbar
|
||||||
config(['debugbar.enabled', false]);
|
config(['debugbar.enabled', false]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty for default user.
|
* Empty for default user.
|
||||||
*
|
*
|
||||||
* @param User|null $user
|
* @param User|null $user
|
||||||
* @param Company|null $company
|
* @param Company|null $company
|
||||||
* @return FeatureTestCase
|
* @return FeatureTestCase
|
||||||
*/
|
*/
|
||||||
public function loginAs(User $user = null, Company $company = null)
|
public function loginAs(User $user = null, Company $company = null)
|
||||||
{
|
{
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
$user = $this->user;
|
$user = $this->user;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$company) {
|
if (!$company) {
|
||||||
$company = $this->company;
|
$company = $this->company;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->startSession();
|
$this->startSession();
|
||||||
|
|
||||||
return $this->actingAs($user)->withSession(['company_id' => $company->id]);
|
return $this->actingAs($user)->withSession(['company_id' => $company->id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function assertFlashLevel($excepted)
|
public function assertFlashLevel($excepted)
|
||||||
{
|
{
|
||||||
$flash['level'] = null;
|
$flash['level'] = null;
|
||||||
|
|
||||||
if ($flashMessage = session('flash_notification')) {
|
if ($flashMessage = session('flash_notification')) {
|
||||||
$flash = $flashMessage->first();
|
$flash = $flashMessage->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertEquals($excepted, $flash['level']);
|
$this->assertEquals($excepted, $flash['level']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user