Skip to content

Commit e6fca46

Browse files
committed
MAGETWO-44635: Running module:enable --all via CLI before installation prevents running further commands
- Fixing unit test
1 parent c196bce commit e6fca46

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ protected function setUp()
4747

4848
public function testGetAll()
4949
{
50-
$this->config->expects($this->once())->method('isAvailable')->willReturn(true);
5150
$this->setLoadAllExpectation();
5251
$this->setLoadConfigExpectation();
5352
$expected = ['foo' => self::$allFixture['foo']];
@@ -58,15 +57,13 @@ public function testGetAll()
5857
public function testGetAllNoData()
5958
{
6059
$this->loader->expects($this->exactly(2))->method('load')->willReturn([]);
61-
$this->config->expects($this->never())->method('isAvailable');
6260
$this->setLoadConfigExpectation(false);
6361
$this->assertEquals([], $this->model->getAll());
6462
$this->assertEquals([], $this->model->getAll());
6563
}
6664

6765
public function testGetOne()
6866
{
69-
$this->config->expects($this->once())->method('isAvailable')->willReturn(true);
7067
$this->setLoadAllExpectation();
7168
$this->setLoadConfigExpectation();
7269
$this->assertSame(['key' => 'value'], $this->model->getOne('foo'));
@@ -75,7 +72,6 @@ public function testGetOne()
7572

7673
public function testGetNames()
7774
{
78-
$this->config->expects($this->once())->method('isAvailable')->willReturn(true);
7975
$this->setLoadAllExpectation(false);
8076
$this->setLoadConfigExpectation();
8177
$this->assertSame(['foo'], $this->model->getNames());
@@ -84,7 +80,6 @@ public function testGetNames()
8480

8581
public function testHas()
8682
{
87-
$this->config->expects($this->once())->method('isAvailable')->willReturn(true);
8883
$this->setLoadAllExpectation(false);
8984
$this->setLoadConfigExpectation();
9085
$this->assertTrue($this->model->has('foo'));
@@ -93,15 +88,14 @@ public function testHas()
9388

9489
public function testIsModuleInfoAvailable()
9590
{
96-
$this->config->expects($this->once())->method('isAvailable')->willReturn(true);
9791
$this->setLoadConfigExpectation(true);
9892
$this->assertTrue($this->model->isModuleInfoAvailable());
9993
}
10094

10195
public function testIsModuleInfoAvailableNoConfig()
10296
{
103-
$this->config->expects($this->once())->method('isAvailable')->willReturn(true);
104-
$this->config->expects($this->once())->method('get')->willReturn(null);
97+
$this->config->expects($this->at(0))->method('get')->willReturn(['modules' => 'testModule']);
98+
$this->config->expects($this->at(1))->method('get')->willReturn(null);
10599
$this->assertFalse($this->model->isModuleInfoAvailable());
106100
}
107101

@@ -114,7 +108,7 @@ public function testIsModuleInfoAvailableNoConfig()
114108
private function setLoadConfigExpectation($isExpected = true)
115109
{
116110
if ($isExpected) {
117-
$this->config->expects($this->once())->method('get')->willReturn(self::$enabledFixture);
111+
$this->config->expects($this->exactly(2))->method('get')->willReturn(self::$enabledFixture);
118112
} else {
119113
$this->config->expects($this->never())->method('get');
120114
}

0 commit comments

Comments
 (0)