Skip to content

Commit 5fb3c26

Browse files
MAGETWO-68928: Fatal error after disabling module
1 parent 0380252 commit 5fb3c26

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

lib/internal/Magento/Framework/Console/Cli.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,22 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
7979
$this->assertCompilerPreparation();
8080
$this->initObjectManager();
8181
$this->assertGenerationPermissions();
82-
83-
if ($version == 'UNKNOWN') {
84-
$directoryList = new DirectoryList(BP);
85-
$composerJsonFinder = new ComposerJsonFinder($directoryList);
86-
$productMetadata = new ProductMetadata($composerJsonFinder);
87-
$version = $productMetadata->getVersion();
88-
}
8982
} catch (\Exception $exception) {
90-
$output = new Console\Output\ConsoleOutput();
83+
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
9184
$output->writeln(
9285
'<error>' . $exception->getMessage() . '</error>'
9386
);
9487

9588
exit(static::RETURN_FAILURE);
9689
}
9790

91+
if ($version == 'UNKNOWN') {
92+
$directoryList = new DirectoryList(BP);
93+
$composerJsonFinder = new ComposerJsonFinder($directoryList);
94+
$productMetadata = new ProductMetadata($composerJsonFinder);
95+
$version = $productMetadata->getVersion();
96+
}
97+
9898
parent::__construct($name, $version);
9999
}
100100

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Framework\Console\Test\Unit\Exception;
7+
8+
use Magento\Framework\Console\Exception\GenerationDirectoryAccessException;
9+
10+
class GenerationDirectoryAccessExceptionTest extends \PHPUnit_Framework_TestCase
11+
{
12+
public function testConstructor()
13+
{
14+
$exception = new GenerationDirectoryAccessException();
15+
16+
$this->assertContains(
17+
'Command line user does not have read and write permissions on generated directory.',
18+
$exception->getMessage()
19+
);
20+
}
21+
}

0 commit comments

Comments
 (0)