| @@ 60-76 (lines=17) @@ | ||
| 57 | /** |
|
| 58 | * @covers \SWP\Bundle\MultiTenancyBundle\Command\CreateOrganizationCommand |
|
| 59 | */ |
|
| 60 | public function testExecuteWhenCreatingDefaultOrganization() |
|
| 61 | { |
|
| 62 | $organization = new Organization(); |
|
| 63 | $organization->setCode('123456'); |
|
| 64 | $this->command->setContainer($this->getMockContainer(null, $organization)); |
|
| 65 | $this->commandTester = new CommandTester($this->command); |
|
| 66 | ||
| 67 | $this->commandTester->execute([ |
|
| 68 | 'command' => $this->command->getName(), |
|
| 69 | '--default' => true, |
|
| 70 | ]); |
|
| 71 | ||
| 72 | $this->assertEquals( |
|
| 73 | 'Organization default (code: 123456) has been created and enabled!', |
|
| 74 | trim($this->commandTester->getDisplay()) |
|
| 75 | ); |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * @expectedException \InvalidArgumentException |
|
| @@ 65-81 (lines=17) @@ | ||
| 62 | /** |
|
| 63 | * @covers \SWP\Bundle\MultiTenancyBundle\Command\CreateTenantCommand |
|
| 64 | */ |
|
| 65 | public function testExecuteWhenCreatingDefaultTenant() |
|
| 66 | { |
|
| 67 | $tenant = new Tenant(); |
|
| 68 | $tenant->setCode('123abc'); |
|
| 69 | $this->command->setContainer($this->getMockContainer(null, new Organization(), $tenant)); |
|
| 70 | $this->commandTester = new CommandTester($this->command); |
|
| 71 | ||
| 72 | $this->commandTester->execute([ |
|
| 73 | 'command' => $this->command->getName(), |
|
| 74 | '--default' => true, |
|
| 75 | ]); |
|
| 76 | ||
| 77 | $this->assertContains( |
|
| 78 | 'Tenant Default tenant (code: 123abc) has been created and enabled!', |
|
| 79 | $this->commandTester->getDisplay() |
|
| 80 | ); |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * @covers \SWP\Bundle\MultiTenancyBundle\Command\CreateTenantCommand |
|
| @@ 43-55 (lines=13) @@ | ||
| 40 | /** |
|
| 41 | * @covers \SWP\Bundle\MultiTenancyBundle\Command\ListTenantsCommand |
|
| 42 | */ |
|
| 43 | public function testExecuteWhenNoTenants() |
|
| 44 | { |
|
| 45 | $tenant = new Tenant(); |
|
| 46 | $tenant->setCode('123abc'); |
|
| 47 | $this->command->setContainer($this->getMockContainer(new Organization())); |
|
| 48 | $this->commandTester = new CommandTester($this->command); |
|
| 49 | $this->commandTester->execute(['command' => $this->command->getName()]); |
|
| 50 | ||
| 51 | $this->assertContains( |
|
| 52 | 'There are no tenants defined.', |
|
| 53 | trim($this->commandTester->getDisplay()) |
|
| 54 | ); |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * @covers \SWP\Bundle\MultiTenancyBundle\Command\ListTenantsCommand |
|