@@ 56-72 (lines=17) @@ | ||
53 | /** |
|
54 | * @covers \SWP\Bundle\MultiTenancyBundle\Command\CreateTenantCommand |
|
55 | */ |
|
56 | public function testExecuteWhenCreatingNewTenant() |
|
57 | { |
|
58 | $tenant = new Tenant(); |
|
59 | $tenant->setCode('123abc'); |
|
60 | ||
61 | $container = $this->getMockContainer(null, new Organization(), $tenant, 'subdomain', 'domain.dev'); |
|
62 | $this->setupCommand($container); |
|
63 | ||
64 | $this->commandTester = new CommandTester($this->command); |
|
65 | $this->commandTester->setInputs(['domain.dev', null, 'Test', '123456']); |
|
66 | $this->commandTester->execute(['command' => $this->command->getName()]); |
|
67 | ||
68 | $this->assertContains( |
|
69 | 'Please enter domain:Please enter subdomain:Please enter name:Please enter organization code:Tenant Test (code: 123abc) has been created and enabled!', |
|
70 | $this->commandTester->getDisplay() |
|
71 | ); |
|
72 | } |
|
73 | ||
74 | /** |
|
75 | * @covers \SWP\Bundle\MultiTenancyBundle\Command\CreateTenantCommand |
|
@@ 137-155 (lines=19) @@ | ||
134 | /** |
|
135 | * @covers \SWP\Bundle\MultiTenancyBundle\Command\CreateTenantCommand |
|
136 | */ |
|
137 | public function testExecuteDisabledTenant() |
|
138 | { |
|
139 | $tenant = new Tenant(); |
|
140 | $tenant->setCode('123abc'); |
|
141 | $container = $this->getMockContainer(null, new Organization(), $tenant, 'example', 'example.com'); |
|
142 | $this->setupCommand($container); |
|
143 | ||
144 | $this->commandTester = new CommandTester($this->command); |
|
145 | $this->commandTester->setInputs(['example.com', null, 'Example', '123456']); |
|
146 | $this->commandTester->execute([ |
|
147 | 'command' => $this->command->getName(), |
|
148 | '--disabled' => true, |
|
149 | ]); |
|
150 | ||
151 | $this->assertContains( |
|
152 | 'Please enter domain:Please enter subdomain:Please enter name:Please enter organization code:Tenant Example (code: 123abc) has been created and disabled!', |
|
153 | $this->commandTester->getDisplay() |
|
154 | ); |
|
155 | } |
|
156 | ||
157 | private function getMockContainer($mockTenant = null, $mockOrganization = null, $mockedTenantInFactory = null, $subdomain = 'default', $domain = 'localhost') |
|
158 | { |