Changeset View
Changeset View
Standalone View
Standalone View
src/tests/TestCaseTrait.php
Show All 9 Lines | |||||
use App\Resource; | use App\Resource; | ||||
use App\SharedFolder; | use App\SharedFolder; | ||||
use App\Sku; | use App\Sku; | ||||
use App\Transaction; | use App\Transaction; | ||||
use App\User; | use App\User; | ||||
use Carbon\Carbon; | use Carbon\Carbon; | ||||
use Illuminate\Contracts\Console\Kernel; | use Illuminate\Contracts\Console\Kernel; | ||||
use Illuminate\Support\Facades\Queue; | use Illuminate\Support\Facades\Queue; | ||||
use Illuminate\Support\Facades\Cache; | |||||
use PHPUnit\Framework\Assert; | use PHPUnit\Framework\Assert; | ||||
trait TestCaseTrait | trait TestCaseTrait | ||||
{ | { | ||||
/** | /** | ||||
* A domain that is hosted. | * A domain that is hosted. | ||||
* | * | ||||
* @var ?\App\Domain | * @var ?\App\Domain | ||||
▲ Show 20 Lines • Show All 701 Lines • ▼ Show 20 Lines | protected function setUpTest() | ||||
$this->publicDomain = \App\Domain::where('type', \App\Domain::TYPE_PUBLIC)->first(); | $this->publicDomain = \App\Domain::where('type', \App\Domain::TYPE_PUBLIC)->first(); | ||||
$this->publicDomainUser = $this->getTestUser( | $this->publicDomainUser = $this->getTestUser( | ||||
'john@' . $this->publicDomain->namespace, | 'john@' . $this->publicDomain->namespace, | ||||
['password' => $this->userPassword] | ['password' => $this->userPassword] | ||||
); | ); | ||||
$this->publicDomainUser->assignPackage($packageKolab); | $this->publicDomainUser->assignPackage($packageKolab); | ||||
Cache::forget('duskconfig'); | |||||
} | } | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
foreach ($this->domainUsers as $user) { | foreach ($this->domainUsers as $user) { | ||||
if ($user == $this->domainOwner) { | if ($user == $this->domainOwner) { | ||||
continue; | continue; | ||||
} | } | ||||
$this->deleteTestUser($user->email); | $this->deleteTestUser($user->email); | ||||
} | } | ||||
if ($this->domainOwner) { | if ($this->domainOwner) { | ||||
$this->deleteTestUser($this->domainOwner->email); | $this->deleteTestUser($this->domainOwner->email); | ||||
} | } | ||||
if ($this->domainHosted) { | if ($this->domainHosted) { | ||||
$this->deleteTestDomain($this->domainHosted->namespace); | $this->deleteTestDomain($this->domainHosted->namespace); | ||||
} | } | ||||
if ($this->publicDomainUser) { | if ($this->publicDomainUser) { | ||||
$this->deleteTestUser($this->publicDomainUser->email); | $this->deleteTestUser($this->publicDomainUser->email); | ||||
} | } | ||||
Cache::forget('duskconfig'); | |||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
} | } |