Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/SignupTest.php
Show All 25 Lines | public function setUp(): void | ||||
$this->domain = $this->getPublicDomain(); | $this->domain = $this->getPublicDomain(); | ||||
$this->deleteTestUser("SignupControllerTest1@$this->domain"); | $this->deleteTestUser("SignupControllerTest1@$this->domain"); | ||||
$this->deleteTestUser("signuplogin@$this->domain"); | $this->deleteTestUser("signuplogin@$this->domain"); | ||||
$this->deleteTestUser("admin@external.com"); | $this->deleteTestUser("admin@external.com"); | ||||
$this->deleteTestDomain('external.com'); | $this->deleteTestDomain('external.com'); | ||||
$this->deleteTestDomain('signup-domain.com'); | $this->deleteTestDomain('signup-domain.com'); | ||||
$this->deleteTestGroup('group-test@kolabnow.com'); | |||||
} | } | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
$this->deleteTestUser("SignupControllerTest1@$this->domain"); | $this->deleteTestUser("SignupControllerTest1@$this->domain"); | ||||
$this->deleteTestUser("signuplogin@$this->domain"); | $this->deleteTestUser("signuplogin@$this->domain"); | ||||
$this->deleteTestUser("admin@external.com"); | $this->deleteTestUser("admin@external.com"); | ||||
$this->deleteTestDomain('external.com'); | $this->deleteTestDomain('external.com'); | ||||
$this->deleteTestDomain('signup-domain.com'); | $this->deleteTestDomain('signup-domain.com'); | ||||
$this->deleteTestGroup('group-test@kolabnow.com'); | |||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Return a public domain for signup tests | * Return a public domain for signup tests | ||||
*/ | */ | ||||
private function getPublicDomain(): string | private function getPublicDomain(): string | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 625 Lines • ▼ Show 20 Lines | class SignupTest extends TestCase | ||||
* @dataProvider dataValidateLogin | * @dataProvider dataValidateLogin | ||||
*/ | */ | ||||
public function testValidateLogin($login, $domain, $external, $expected_result): void | public function testValidateLogin($login, $domain, $external, $expected_result): void | ||||
{ | { | ||||
$result = $this->invokeMethod(new SignupController(), 'validateLogin', [$login, $domain, $external]); | $result = $this->invokeMethod(new SignupController(), 'validateLogin', [$login, $domain, $external]); | ||||
$this->assertSame($expected_result, $result); | $this->assertSame($expected_result, $result); | ||||
} | } | ||||
/** | |||||
* Signup login/domain validation, more cases | |||||
* | |||||
* Note: Technically these include unit tests, but let's keep it here for now. | |||||
*/ | |||||
public function testValidateLoginMore(): void | |||||
{ | |||||
$group = $this->getTestGroup('group-test@kolabnow.com'); | |||||
$login = 'group-test'; | |||||
$domain = 'kolabnow.com'; | |||||
$external = false; | |||||
$result = $this->invokeMethod(new SignupController(), 'validateLogin', [$login, $domain, $external]); | |||||
$this->assertSame(['login' => 'The specified login is not available.'], $result); | |||||
} | |||||
} | } |