/
ModuleActivateCommandTest.php
62 lines (49 loc) · 2.04 KB
/
ModuleActivateCommandTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php declare(strict_types=1);
/**
* Copyright © OXID eSales AG. All rights reserved.
* See LICENSE file for license details.
*/
namespace OxidEsales\EshopCommunity\Tests\Integration\Internal\Module\Command;
use OxidEsales\Eshop\Core\Module\Module;
use OxidEsales\EshopCommunity\Internal\Module\Command\ModuleActivateCommand;
use Symfony\Component\Console\Input\ArrayInput;
class ModuleActivateCommandTest extends ModuleCommandsTestCase
{
public function testModuleActivation()
{
$this->prepareTestData();
$moduleId = 'testmodule';
$consoleOutput = $this->execute(
$this->getApplication(),
$this->get('console.commands_collection_builder'),
new ArrayInput(['command' => 'oe:module:activate', 'module-id' => $moduleId])
);
$this->assertSame(sprintf(ModuleActivateCommand::MESSAGE_MODULE_ACTIVATED, $moduleId) . PHP_EOL, $consoleOutput);
$module = oxNew(Module::class);
$module->load($moduleId);
$this->assertTrue($module->isActive());
$this->cleanupTestData();
}
public function testWhenModuleAlreadyActive()
{
$this->prepareTestData();
$moduleId = 'testmodule';
$consoleOutput = $this->execute(
$this->getApplication(),
$this->get('console.commands_collection_builder'),
new ArrayInput(['command' => 'oe:module:activate', 'module-id' => $moduleId])
);
$this->assertSame(sprintf(ModuleActivateCommand::MESSAGE_MODULE_ALREADY_ACTIVE, $moduleId) . PHP_EOL, $consoleOutput);
$this->cleanupTestData();
}
public function testNonExistingModuleActivation()
{
$moduleId = 'test';
$consoleOutput = $this->execute(
$this->getApplication(),
$this->get('console.commands_collection_builder'),
new ArrayInput(['command' => 'oe:module:activate', 'module-id' => $moduleId])
);
$this->assertSame(sprintf(ModuleActivateCommand::MESSAGE_MODULE_NOT_FOUND, $moduleId) . PHP_EOL, $consoleOutput);
}
}