Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/UserTest.php
Show First 20 Lines • Show All 404 Lines • ▼ Show 20 Lines | public function testSetAliases(): void | ||||
$this->assertSame('useralias1@useraccount.com', $aliases[0]['alias']); | $this->assertSame('useralias1@useraccount.com', $aliases[0]['alias']); | ||||
// Remove all aliases | // Remove all aliases | ||||
$user->setAliases([]); | $user->setAliases([]); | ||||
Queue::assertPushed(\App\Jobs\User\UpdateJob::class, 4); | Queue::assertPushed(\App\Jobs\User\UpdateJob::class, 4); | ||||
$this->assertCount(0, $user->aliases()->get()); | $this->assertCount(0, $user->aliases()->get()); | ||||
// The test below fail since we removed validation code from the UserAliasObserver | |||||
$this->markTestIncomplete(); | |||||
// Test sanity checks in UserAliasObserver | |||||
Queue::fake(); | |||||
// Existing user | |||||
$user->setAliases(['john@kolab.org']); | |||||
$this->assertCount(0, $user->aliases()->get()); | |||||
// Existing alias (in another account) | |||||
$user->setAliases(['john.doe@kolab.org']); | |||||
$this->assertCount(0, $user->aliases()->get()); | |||||
Queue::assertNothingPushed(); | |||||
// Existing user (in the same group account) | |||||
$ned = $this->getTestUser('ned@kolab.org'); | |||||
$ned->setAliases(['john@kolab.org']); | |||||
$this->assertCount(0, $ned->aliases()->get()); | |||||
// Existing alias (in the same group account) | |||||
$ned = $this->getTestUser('ned@kolab.org'); | |||||
$ned->setAliases(['john.doe@kolab.org']); | |||||
$this->assertSame('john.doe@kolab.org', $ned->aliases()->first()->alias); | |||||
// Existing alias (in another account, public domain) | |||||
$user->setAliases(['alias@kolabnow.com']); | |||||
$ned->setAliases(['alias@kolabnow.com']); | |||||
$this->assertCount(0, $ned->aliases()->get()); | |||||
// cleanup | |||||
$ned->setAliases([]); | |||||
} | } | ||||
/** | /** | ||||
* Tests for UserSettingsTrait::setSettings() and getSetting() | * Tests for UserSettingsTrait::setSettings() and getSetting() | ||||
*/ | */ | ||||
public function testUserSettings(): void | public function testUserSettings(): void | ||||
{ | { | ||||
Queue::fake(); | Queue::fake(); | ||||
▲ Show 20 Lines • Show All 116 Lines • Show Last 20 Lines |