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