-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1173 from magento-falcons/MAGETWO-69556
[Falcons] Delivery of bug fixes for Setup and Deployment
- Loading branch information
Showing
8 changed files
with
167 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
lib/internal/Magento/Framework/Console/Exception/GenerationDirectoryAccessException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Framework\Console\Exception; | ||
|
||
use Magento\Framework\App\Filesystem\DirectoryList; | ||
use Magento\Framework\Exception\FileSystemException; | ||
use Magento\Framework\Phrase; | ||
|
||
/** | ||
* The default exception for missing write permissions on compilation generated folder. | ||
*/ | ||
class GenerationDirectoryAccessException extends FileSystemException | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function __construct(Phrase $phrase = null, \Exception $cause = null, $code = 0) | ||
{ | ||
$phrase = $phrase ?: new Phrase( | ||
'Command line user does not have read and write permissions on ' | ||
. $this->getDefaultDirectoryPath(DirectoryList::GENERATED) . ' directory. ' | ||
. 'Please address this issue before using Magento command line.' | ||
); | ||
|
||
parent::__construct($phrase, $cause, $code); | ||
} | ||
|
||
/** | ||
* Get default directory path by code | ||
* | ||
* @param string $code | ||
* @return string | ||
*/ | ||
private function getDefaultDirectoryPath($code) | ||
{ | ||
$config = DirectoryList::getDefaultConfig(); | ||
$result = ''; | ||
|
||
if (isset($config[$code][DirectoryList::PATH])) { | ||
$result = $config[$code][DirectoryList::PATH]; | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
.../Magento/Framework/Console/Test/Unit/Exception/GenerationDirectoryAccessExceptionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Framework\Console\Test\Unit\Exception; | ||
|
||
use Magento\Framework\Console\Exception\GenerationDirectoryAccessException; | ||
|
||
class GenerationDirectoryAccessExceptionTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testConstructor() | ||
{ | ||
$exception = new GenerationDirectoryAccessException(); | ||
|
||
$this->assertContains( | ||
'Command line user does not have read and write permissions on generated directory.', | ||
$exception->getMessage() | ||
); | ||
} | ||
} |
Oops, something went wrong.