Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/Admin/UsersTest.php
Show All 32 Lines | class UsersTest extends TestCase | ||||
{ | { | ||||
$this->deleteTestUser('UsersControllerTest1@userscontroller.com'); | $this->deleteTestUser('UsersControllerTest1@userscontroller.com'); | ||||
$this->deleteTestUser('test@testsearch.com'); | $this->deleteTestUser('test@testsearch.com'); | ||||
$this->deleteTestDomain('testsearch.com'); | $this->deleteTestDomain('testsearch.com'); | ||||
$jack = $this->getTestUser('jack@kolab.org'); | $jack = $this->getTestUser('jack@kolab.org'); | ||||
$jack->setSetting('external_email', null); | $jack->setSetting('external_email', null); | ||||
\App\SharedFolderAlias::truncate(); | |||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test user deleting (DELETE /api/v4/users/<id>) | * Test user deleting (DELETE /api/v4/users/<id>) | ||||
*/ | */ | ||||
public function testDestroy(): void | public function testDestroy(): void | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | public function testIndex(): void | ||||
$json = $response->json(); | $json = $response->json(); | ||||
$this->assertSame(1, $json['count']); | $this->assertSame(1, $json['count']); | ||||
$this->assertCount(1, $json['list']); | $this->assertCount(1, $json['list']); | ||||
$this->assertSame($user->id, $json['list'][0]['id']); | $this->assertSame($user->id, $json['list'][0]['id']); | ||||
$this->assertSame($user->email, $json['list'][0]['email']); | $this->assertSame($user->email, $json['list'][0]['email']); | ||||
// Search by shared folder alias | |||||
$folder = $this->getTestSharedFolder('folder-event@kolab.org'); | |||||
$folder->setAliases(['folder-alias@kolab.org']); | |||||
$response = $this->actingAs($admin)->get("api/v4/users?search=folder-alias@kolab.org"); | |||||
$response->assertStatus(200); | |||||
$json = $response->json(); | |||||
$this->assertSame(1, $json['count']); | |||||
$this->assertCount(1, $json['list']); | |||||
$this->assertSame($user->id, $json['list'][0]['id']); | |||||
$this->assertSame($user->email, $json['list'][0]['email']); | |||||
// Deleted users/domains | // Deleted users/domains | ||||
$domain = $this->getTestDomain('testsearch.com', ['type' => \App\Domain::TYPE_EXTERNAL]); | $domain = $this->getTestDomain('testsearch.com', ['type' => \App\Domain::TYPE_EXTERNAL]); | ||||
$user = $this->getTestUser('test@testsearch.com'); | $user = $this->getTestUser('test@testsearch.com'); | ||||
$plan = \App\Plan::where('title', 'group')->first(); | $plan = \App\Plan::where('title', 'group')->first(); | ||||
$user->assignPlan($plan, $domain); | $user->assignPlan($plan, $domain); | ||||
$user->setAliases(['alias@testsearch.com']); | $user->setAliases(['alias@testsearch.com']); | ||||
$wallet = $user->wallets()->first(); | $wallet = $user->wallets()->first(); | ||||
▲ Show 20 Lines • Show All 297 Lines • Show Last 20 Lines |