Skip to content

Commit cef92a1

Browse files
committed
Merge pull request #134 from magento-ogre/develop
[Ogres] Sprint 25 Bug Fixes
2 parents 8e8d3ae + 1d1766e commit cef92a1

File tree

21 files changed

+442
-55
lines changed

21 files changed

+442
-55
lines changed

app/code/Magento/PageCache/Controller/Block/Render.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public function execute()
1919
$this->_forward('noroute');
2020
return;
2121
}
22-
22+
// disable profiling during private content handling AJAX call
23+
\Magento\Framework\Profiler::reset();
2324
$blocks = $this->_getBlocks();
2425
$data = [];
2526
foreach ($blocks as $blockName => $blockInstance) {

app/etc/vendor_path.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?php
2-
/**
3-
* Copyright © 2015 Magento. All rights reserved.
4-
* See COPYING.txt for license details.
5-
*/
6-
72
/**
83
* Path to Composer vendor directory
94
*/
10-
return 'vendor';
5+
return './vendor';

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"magento/zendframework1": "1.12.10",
3333
"composer/composer": "1.0.0-alpha8",
3434
"monolog/monolog": "1.11.0",
35-
"tubalmartin/cssmin": "2.4.8-p4"
35+
"tubalmartin/cssmin": "2.4.8-p4",
36+
"magento/magento-composer-installer": "*"
3637
},
3738
"require-dev": {
3839
"phpunit/phpunit": "4.1.0",
@@ -194,7 +195,8 @@
194195
},
195196
"autoload": {
196197
"psr-4": {
197-
"Magento\\Framework\\": "lib/internal/Magento/Framework/"
198+
"Magento\\Framework\\": "lib/internal/Magento/Framework/",
199+
"Magento\\Setup\\": "setup/src/Magento/Setup/"
198200
}
199201
},
200202
"autoload-dev": {
@@ -204,8 +206,7 @@
204206
"Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
205207
"Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
206208
"Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/",
207-
"Magento\\ToolkitFramework\\": "dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/",
208-
"Magento\\Setup\\": "setup/src/Magento/Setup/"
209+
"Magento\\ToolkitFramework\\": "dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/"
209210
}
210211
}
211212
}

composer.lock

Lines changed: 77 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tools/Magento/Tools/View/deploy.php

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
define('USAGE', "USAGE:\n\tphp -f {$baseName} -- [--langs=en_US,de_DE,...] [--verbose=0|1] [--dry-run] [--help]\n");
1717
require __DIR__ . '/../../../../../app/bootstrap.php';
1818

19-
AutoloaderRegistry::getAutoloader()->addPsr4(
20-
'Magento\\',
21-
[BP . '/dev/tests/static/framework/Magento/', realpath(__DIR__ . '/../../../Magento/')]
22-
);
19+
AutoloaderRegistry::getAutoloader()->addPsr4('Magento\\', [BP . '/tools/Magento/']);
2320

2421
// parse all options
2522
if (isset($options['help'])) {
@@ -42,26 +39,31 @@
4239
$verbosity = 0 === (int)$options['verbose'] ? \Magento\Tools\View\Deployer\Log::SILENT
4340
: \Magento\Tools\View\Deployer\Log::ERROR | \Magento\Tools\View\Deployer\Log::DEBUG;
4441
}
42+
$logger = new \Magento\Tools\View\Deployer\Log($verbosity);
4543

46-
// run the deployment logic
47-
$filesUtil = new \Magento\Framework\App\Utility\Files(BP);
48-
$omFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, []);
49-
$objectManager = $omFactory->create(
50-
[\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_DEFAULT]
51-
);
44+
try {
45+
// run the deployment logic
46+
$filesUtil = new \Magento\Framework\Test\Utility\Files(BP);
47+
$omFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, []);
48+
$objectManager = $omFactory->create(
49+
[\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_DEFAULT]
50+
);
5251

53-
/** @var \Magento\Framework\App\DeploymentConfig $deploymentConfig */
54-
$deploymentConfig = $objectManager->get('Magento\Framework\App\DeploymentConfig');
55-
$isAppInstalled = $deploymentConfig->isAvailable();
56-
if (!$isAppInstalled) {
57-
throw new \Exception('Please install the Magento application before running this process.');
58-
}
52+
/** @var \Magento\Framework\App\DeploymentConfig $deploymentConfig */
53+
$deploymentConfig = $objectManager->get('Magento\Framework\App\DeploymentConfig');
54+
$isAppInstalled = $deploymentConfig->isAvailable();
55+
if (!$isAppInstalled) {
56+
throw new \Exception('You need to install the Magento application before running this utility.');
57+
}
5958

60-
$logger = new \Magento\Tools\View\Deployer\Log($verbosity);
61-
/** @var \Magento\Tools\View\Deployer $deployer */
62-
$deployer = $objectManager->create(
63-
'Magento\Tools\View\Deployer',
64-
['filesUtil' => $filesUtil, 'logger' => $logger, 'isDryRun' => $isDryRun]
65-
);
66-
$deployer->deploy($omFactory, $langs);
67-
exit(0);
59+
/** @var \Magento\Tools\View\Deployer $deployer */
60+
$deployer = $objectManager->create(
61+
'Magento\Tools\View\Deployer',
62+
['filesUtil' => $filesUtil, 'logger' => $logger, 'isDryRun' => $isDryRun]
63+
);
64+
$deployer->deploy($omFactory, $langs);
65+
} catch (\Exception $e) {
66+
$logger->logError($e->getMessage());
67+
$logger->logDebug($e->getTraceAsString());
68+
exit(1);
69+
}

lib/internal/Magento/Framework/App/StaticResource.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public function __construct(
9999
*/
100100
public function launch()
101101
{
102+
// disabling profiling when retrieving static resource
103+
\Magento\Framework\Profiler::reset();
102104
$appMode = $this->state->getMode();
103105
if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) {
104106
$this->response->setHttpResponseCode(404);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Framework\Module\ModuleList;
8+
9+
/**
10+
* Factory for Deployment configuration segment for modules
11+
*/
12+
class DeploymentConfigFactory
13+
{
14+
/**
15+
* Factory method for Deployment Config object
16+
*
17+
* @param array $data
18+
* @return DeploymentConfig
19+
*/
20+
public function create(array $data)
21+
{
22+
return new DeploymentConfig($data);
23+
}
24+
}

lib/internal/Magento/Framework/Module/Status.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
namespace Magento\Framework\Module;
88

99
use Magento\Framework\App\DeploymentConfig\Writer;
10+
use Magento\Framework\Module\ModuleList\DeploymentConfigFactory;
1011
use Magento\Framework\App\State\Cleanup;
1112

1213
/**
1314
* A service for controlling module status
15+
*
16+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1417
*/
1518
class Status
1619
{
@@ -56,6 +59,13 @@ class Status
5659
*/
5760
private $conflictChecker;
5861

62+
/**
63+
* Factory to create module deployment config object
64+
*
65+
* @var DeploymentConfigFactory
66+
*/
67+
private $deploymentConfigFactory;
68+
5969
/**
6070
* Constructor
6171
*
@@ -65,21 +75,24 @@ class Status
6575
* @param Cleanup $cleanup
6676
* @param ConflictChecker $conflictChecker
6777
* @param DependencyChecker $dependencyChecker
78+
* @param DeploymentConfigFactory $deploymentConfigFactory
6879
*/
6980
public function __construct(
7081
ModuleList\Loader $loader,
7182
ModuleList $list,
7283
Writer $writer,
7384
Cleanup $cleanup,
7485
ConflictChecker $conflictChecker,
75-
DependencyChecker $dependencyChecker
86+
DependencyChecker $dependencyChecker,
87+
DeploymentConfigFactory $deploymentConfigFactory
7688
) {
7789
$this->loader = $loader;
7890
$this->list = $list;
7991
$this->writer = $writer;
8092
$this->cleanup = $cleanup;
8193
$this->conflictChecker = $conflictChecker;
8294
$this->dependencyChecker = $dependencyChecker;
95+
$this->deploymentConfigFactory = $deploymentConfigFactory;
8396
}
8497

8598
/**
@@ -159,7 +172,7 @@ public function setIsEnabled($isEnabled, $modules)
159172
$result[$name] = $currentStatus;
160173
}
161174
}
162-
$segment = new ModuleList\DeploymentConfig($result);
175+
$segment = $this->deploymentConfigFactory->create($result);
163176
$this->writer->update($segment);
164177
$this->cleanup->clearCaches();
165178
$this->cleanup->clearCodeGeneratedFiles();
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Framework\Module\Test\Unit\ModuleList;
8+
9+
use Magento\Framework\Module\ModuleList\DeploymentConfigFactory;
10+
11+
class DeploymentConfigFactoryTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/**
14+
* @var DeploymentConfigFactory
15+
*/
16+
protected $object;
17+
18+
public function testCreate()
19+
{
20+
$this->object = new DeploymentConfigFactory();
21+
$this->assertInstanceOf(
22+
'Magento\Framework\Module\ModuleList\DeploymentConfig',
23+
$this->object->create(['Module_One' => 0, 'Module_Two' =>1])
24+
);
25+
}
26+
}

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ class StatusTest extends \PHPUnit_Framework_TestCase
4040
*/
4141
private $dependencyChecker;
4242

43+
/**
44+
* @var \PHPUnit_Framework_MockObject_MockObject
45+
*/
46+
private $deploymentConfigFactory;
47+
4348
/**
4449
* @var Status
4550
*/
@@ -53,13 +58,21 @@ protected function setUp()
5358
$this->cleanup = $this->getMock('Magento\Framework\App\State\Cleanup', [], [], '', false);
5459
$this->conflictChecker = $this->getMock('Magento\Framework\Module\ConflictChecker', [], [], '', false);
5560
$this->dependencyChecker = $this->getMock('Magento\Framework\Module\DependencyChecker', [], [], '', false);
61+
$this->deploymentConfigFactory = $this->getMock(
62+
'Magento\Framework\Module\ModuleList\DeploymentConfigFactory',
63+
[],
64+
[],
65+
'',
66+
false
67+
);
5668
$this->object = new Status(
5769
$this->loader,
5870
$this->moduleList,
5971
$this->writer,
6072
$this->cleanup,
6173
$this->conflictChecker,
62-
$this->dependencyChecker
74+
$this->dependencyChecker,
75+
$this->deploymentConfigFactory
6376
);
6477
}
6578

@@ -167,10 +180,11 @@ public function testSetIsEnabled()
167180
$this->moduleList->expects($this->at(0))->method('has')->with('Module_Foo')->willReturn(false);
168181
$this->moduleList->expects($this->at(1))->method('has')->with('Module_Bar')->willReturn(false);
169182
$this->moduleList->expects($this->at(2))->method('has')->with('Module_Baz')->willReturn(false);
170-
$constraint = new \PHPUnit_Framework_Constraint_IsInstanceOf(
171-
'Magento\Framework\Module\ModuleList\DeploymentConfig'
172-
);
173-
$this->writer->expects($this->once())->method('update')->with($constraint);
183+
$deploymentConfig = $this->getMock('Magento\Framework\Module\ModuleList\DeploymentConfig', [], [], '', false);
184+
$expectedModules = ['Module_Foo' => 1, 'Module_Bar' => 1, 'Module_Baz' => 0];
185+
$this->deploymentConfigFactory->expects($this->once())->method('create')->with($expectedModules)
186+
->willReturn($deploymentConfig);
187+
$this->writer->expects($this->once())->method('update')->with($deploymentConfig);
174188
$this->cleanup->expects($this->once())->method('clearCaches');
175189
$this->cleanup->expects($this->once())->method('clearCodeGeneratedFiles');
176190
$this->object->setIsEnabled(true, ['Module_Foo', 'Module_Bar']);

0 commit comments

Comments
 (0)