Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Admin/UserTest.php
Show All 18 Lines | class UserTest extends TestCaseDusk | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function setUp(): void | public function setUp(): void | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
self::useAdminUrl(); | self::useAdminUrl(); | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$john->update(['status' => $john->status ^= User::STATUS_SUSPENDED]); | |||||
$john->setSettings([ | $john->setSettings([ | ||||
'phone' => '+48123123123', | 'phone' => '+48123123123', | ||||
'external_email' => 'john.doe.external@gmail.com', | 'external_email' => 'john.doe.external@gmail.com', | ||||
]); | ]); | ||||
if ($john->isSuspended()) { | |||||
User::where('email', $john->email)->update(['status' => $john->status - User::STATUS_SUSPENDED]); | |||||
} | |||||
$wallet = $john->wallets()->first(); | $wallet = $john->wallets()->first(); | ||||
$wallet->discount()->dissociate(); | $wallet->discount()->dissociate(); | ||||
$wallet->balance = 0; | $wallet->balance = 0; | ||||
$wallet->save(); | $wallet->save(); | ||||
} | } | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
$john = $this->getTestUser('john@kolab.org'); | $john = $this->getTestUser('john@kolab.org'); | ||||
$john->update(['status' => $john->status ^= User::STATUS_SUSPENDED]); | |||||
$john->setSettings([ | $john->setSettings([ | ||||
'phone' => null, | 'phone' => null, | ||||
'external_email' => 'john.doe.external@gmail.com', | 'external_email' => 'john.doe.external@gmail.com', | ||||
]); | ]); | ||||
if ($john->isSuspended()) { | |||||
User::where('email', $john->email)->update(['status' => $john->status - User::STATUS_SUSPENDED]); | |||||
} | |||||
$wallet = $john->wallets()->first(); | $wallet = $john->wallets()->first(); | ||||
$wallet->discount()->dissociate(); | $wallet->discount()->dissociate(); | ||||
$wallet->balance = 0; | $wallet->balance = 0; | ||||
$wallet->save(); | $wallet->save(); | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 436 Lines • Show Last 20 Lines |