Skip to content

Commit 809df2c

Browse files
committed
Merge pull request #534 from magento-extensibility/MAGETWO-51508-multitenant-compiler
[Extensibility] Bug fixes
2 parents 3ccb057 + 7c81a95 commit 809df2c

File tree

15 files changed

+56
-885
lines changed

15 files changed

+56
-885
lines changed

dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Framework\Api\Code\Generator\Mapper;
1111
use Magento\Framework\Api\Code\Generator\SearchResults;
12+
use Magento\Framework\App\Filesystem\DirectoryList;
1213
use Magento\Framework\Component\ComponentRegistrar;
1314
use Magento\Framework\ObjectManager\Code\Generator\Converter;
1415
use Magento\Framework\ObjectManager\Code\Generator\Factory;
@@ -42,11 +43,6 @@ class CompilerTest extends \PHPUnit_Framework_TestCase
4243
*/
4344
protected $_compilationDir;
4445

45-
/**
46-
* @var string
47-
*/
48-
protected $_tmpDir;
49-
5046
/**
5147
* @var \Magento\Framework\ObjectManager\Config\Mapper\Dom()
5248
*/
@@ -70,17 +66,11 @@ protected function setUp()
7066
$basePath = BP;
7167
$basePath = str_replace('\\', '/', $basePath);
7268

73-
$this->_tmpDir = realpath(__DIR__) . '/tmp';
74-
$this->_generationDir = $this->_tmpDir . '/generation';
75-
if (!file_exists($this->_generationDir)) {
76-
mkdir($this->_generationDir, 0777, true);
77-
}
78-
$this->_compilationDir = $this->_tmpDir . '/di';
79-
if (!file_exists($this->_compilationDir)) {
80-
mkdir($this->_compilationDir, 0777, true);
81-
}
69+
$directoryList = new DirectoryList($basePath);
70+
$this->_generationDir = $directoryList->getPath(DirectoryList::GENERATION);
71+
$this->_compilationDir = $directoryList->getPath(DirectoryList::DI);
8272

83-
$this->_command = 'php ' . $basePath . '/bin/magento setup:di:compile-multi-tenant --generation=%s --di=%s';
73+
$this->_command = 'php ' . $basePath . '/bin/magento setup:di:compile';
8474

8575
$booleanUtils = new \Magento\Framework\Stdlib\BooleanUtils();
8676
$constInterpreter = new \Magento\Framework\Data\Argument\Interpreter\Constant();
@@ -116,14 +106,6 @@ protected function setUp()
116106
$this->pluginValidator = new \Magento\Framework\Interception\Code\InterfaceValidator();
117107
}
118108

119-
protected function tearDown()
120-
{
121-
$filesystem = new \Magento\Framework\Filesystem\Driver\File();
122-
if ($filesystem->isExists($this->_tmpDir)) {
123-
$filesystem->deleteDirectory($this->_tmpDir);
124-
}
125-
}
126-
127109
/**
128110
* Validate DI config file
129111
*
@@ -412,7 +394,7 @@ protected function pluginDataProvider()
412394
public function testCompiler()
413395
{
414396
try {
415-
$this->_shell->execute($this->_command, [$this->_generationDir, $this->_compilationDir]);
397+
$this->_shell->execute($this->_command);
416398
} catch (\Magento\Framework\Exception\LocalizedException $exception) {
417399
$this->fail($exception->getPrevious()->getMessage());
418400
}

lib/internal/Magento/Framework/App/Response/Http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function representJson($content)
156156
*/
157157
public function __sleep()
158158
{
159-
return ['content', 'isRedirect', 'statusCode', 'context'];
159+
return ['content', 'isRedirect', 'statusCode', 'context', 'headers'];
160160
}
161161

162162
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function check()
5757
try {
5858
$probeFilePath = $generationDirectoryPath . DIRECTORY_SEPARATOR . time();
5959
$fileWriteFactory->create($probeFilePath, DriverPool::FILE, 'w');
60-
$directoryWrite->delete($probeFilePath);
60+
$driver->deleteFile($probeFilePath);
6161
} catch (\Exception $e) {
6262
return false;
6363
}

setup/src/Magento/Setup/Console/Command/DiCompileCommand.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,6 @@ private function checkEnvironment()
111111
$messages[] = 'You cannot run this command because the Magento application is not installed.';
112112
}
113113

114-
/**
115-
* By the time the command is able to execute, the Object Management configuration is already contaminated
116-
* by old config info, and it's too late to just clear the files in code.
117-
*
118-
* TODO: reconfigure OM in runtime so DI resources can be cleared after command launches
119-
*
120-
*/
121-
$path = $this->directoryList->getPath(DirectoryList::DI);
122-
if ($this->fileDriver->isExists($path)) {
123-
$messages[] = "DI configuration must be cleared before running compiler. Please delete '$path'.";
124-
}
125-
126114
return $messages;
127115
}
128116

0 commit comments

Comments
 (0)