|
@@ -64,7 +64,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
$this->accessRepository = $this->getMockBuilder(AccessRepository::class)->disableOriginalConstructor()->getMock();
|
|
$this->accessRepository = $this->getMockBuilder(AccessRepository::class)->disableOriginalConstructor()->getMock();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private function makeOnSubdomainChangeMock(string $methodName): MockObject | TestableSubdomainService {
|
|
|
|
|
|
|
+ private function makeSubdomainServiceMockFor(string $methodName): MockObject | TestableSubdomainService {
|
|
|
return $this->getMockBuilder(TestableSubdomainService::class)
|
|
return $this->getMockBuilder(TestableSubdomainService::class)
|
|
|
->setConstructorArgs([
|
|
->setConstructorArgs([
|
|
|
$this->subdomainRepository,
|
|
$this->subdomainRepository,
|
|
@@ -83,7 +83,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
*/
|
|
*/
|
|
|
public function testCanRegisterNewSubdomainTrue(): void
|
|
public function testCanRegisterNewSubdomainTrue(): void
|
|
|
{
|
|
{
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('canRegisterNewSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('canRegisterNewSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
$organization->expects(self::once())->method('getSubdomains')->willReturn(new ArrayCollection([1, 2]));
|
|
$organization->expects(self::once())->method('getSubdomains')->willReturn(new ArrayCollection([1, 2]));
|
|
@@ -96,7 +96,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
*/
|
|
*/
|
|
|
public function testCanRegisterNewSubdomainFalse(): void
|
|
public function testCanRegisterNewSubdomainFalse(): void
|
|
|
{
|
|
{
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('canRegisterNewSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('canRegisterNewSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
$organization->expects(self::once())->method('getSubdomains')->willReturn(new ArrayCollection([1, 2, 3]));
|
|
$organization->expects(self::once())->method('getSubdomains')->willReturn(new ArrayCollection([1, 2, 3]));
|
|
@@ -108,7 +108,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
* @see SubdomainService::isValidSubdomain()
|
|
* @see SubdomainService::isValidSubdomain()
|
|
|
*/
|
|
*/
|
|
|
public function testIsValidSubdomain(): void {
|
|
public function testIsValidSubdomain(): void {
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('isValidSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('isValidSubdomain');
|
|
|
|
|
|
|
|
$this->assertTrue($subdomainService->isValidSubdomain('abcd'));
|
|
$this->assertTrue($subdomainService->isValidSubdomain('abcd'));
|
|
|
$this->assertTrue($subdomainService->isValidSubdomain('abcdefgh'));
|
|
$this->assertTrue($subdomainService->isValidSubdomain('abcdefgh'));
|
|
@@ -122,7 +122,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function testAddNewSubdomain(): void {
|
|
public function testAddNewSubdomain(): void {
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
|
@@ -147,7 +147,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
|
|
|
|
|
public function testAddNewSubdomainInvalid(): void
|
|
public function testAddNewSubdomainInvalid(): void
|
|
|
{
|
|
{
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
|
@@ -168,7 +168,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
|
|
|
|
|
public function testAddNewSubdomainMaxReached(): void
|
|
public function testAddNewSubdomainMaxReached(): void
|
|
|
{
|
|
{
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
|
@@ -189,7 +189,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
|
|
|
|
|
public function testAddNewSubdomainExisting(): void
|
|
public function testAddNewSubdomainExisting(): void
|
|
|
{
|
|
{
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
|
@@ -210,7 +210,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
|
|
|
|
|
public function testAddNewSubdomainAndActivate(): void
|
|
public function testAddNewSubdomainAndActivate(): void
|
|
|
{
|
|
{
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('addNewSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('addNewSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
|
@@ -224,7 +224,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function testActivateSubdomain(): void {
|
|
public function testActivateSubdomain(): void {
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('activateSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('activateSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
|
@@ -265,7 +265,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
|
|
|
|
|
public function testActivateSubdomainAlreadyActive(): void
|
|
public function testActivateSubdomainAlreadyActive(): void
|
|
|
{
|
|
{
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('activateSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('activateSubdomain');
|
|
|
|
|
|
|
|
$subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
|
|
$subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
|
|
|
$subdomain->method('getId')->willReturn(1);
|
|
$subdomain->method('getId')->willReturn(1);
|
|
@@ -285,7 +285,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
|
|
|
|
|
public function testActivateSubdomainNotPersisted(): void
|
|
public function testActivateSubdomainNotPersisted(): void
|
|
|
{
|
|
{
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('activateSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('activateSubdomain');
|
|
|
|
|
|
|
|
$subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
|
|
$subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
|
|
|
$subdomain->method('getId')->willReturn(null);
|
|
$subdomain->method('getId')->willReturn(null);
|
|
@@ -303,7 +303,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function testSetOrganizationActiveSubdomain(): void {
|
|
public function testSetOrganizationActiveSubdomain(): void {
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('setOrganizationActiveSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('setOrganizationActiveSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
|
@@ -340,7 +340,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function testRenameAdminUserToMatchSubdomain(): void {
|
|
public function testRenameAdminUserToMatchSubdomain(): void {
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('renameAdminUserToMatchSubdomain');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('renameAdminUserToMatchSubdomain');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
$person = $this->getMockBuilder(Person::class)->getMock();
|
|
$person = $this->getMockBuilder(Person::class)->getMock();
|
|
@@ -365,7 +365,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function testUpdateTypo3Website(): void {
|
|
public function testUpdateTypo3Website(): void {
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('updateTypo3Website');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('updateTypo3Website');
|
|
|
|
|
|
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
$organization = $this->getMockBuilder(Organization::class)->getMock();
|
|
|
$organization->method('getId')->willReturn(1);
|
|
$organization->method('getId')->willReturn(1);
|
|
@@ -380,7 +380,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function testGetMailModel(): void {
|
|
public function testGetMailModel(): void {
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('getMailModel');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('getMailModel');
|
|
|
|
|
|
|
|
$access = $this->getMockBuilder(Access::class)->getMock();
|
|
$access = $this->getMockBuilder(Access::class)->getMock();
|
|
|
$access->method('getId')->willReturn(1);
|
|
$access->method('getId')->willReturn(1);
|
|
@@ -413,7 +413,7 @@ class SubdomainServiceTest extends TestCase
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function testSendConfirmationEmail(): void {
|
|
public function testSendConfirmationEmail(): void {
|
|
|
- $subdomainService = $this->makeOnSubdomainChangeMock('sendConfirmationEmail');
|
|
|
|
|
|
|
+ $subdomainService = $this->makeSubdomainServiceMockFor('sendConfirmationEmail');
|
|
|
|
|
|
|
|
$subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
|
|
$subdomain = $this->getMockBuilder(Subdomain::class)->getMock();
|
|
|
$subdomainChangeModel = $this->getMockBuilder(SubdomainChangeModel::class)->getMock();
|
|
$subdomainChangeModel = $this->getMockBuilder(SubdomainChangeModel::class)->getMock();
|