Skip to content

Commit

Permalink
Merge pull request #134 from magento-ogre/develop
Browse files Browse the repository at this point in the history
[Ogres] Sprint 25 Bug Fixes
  • Loading branch information
monkeysee committed Mar 14, 2015
2 parents 8e8d3ae + 1d1766e commit cef92a1
Show file tree
Hide file tree
Showing 21 changed files with 442 additions and 55 deletions.
3 changes: 2 additions & 1 deletion app/code/Magento/PageCache/Controller/Block/Render.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public function execute()
$this->_forward('noroute');
return;
}

// disable profiling during private content handling AJAX call
\Magento\Framework\Profiler::reset();
$blocks = $this->_getBlocks();
$data = [];
foreach ($blocks as $blockName => $blockInstance) {
Expand Down
7 changes: 1 addition & 6 deletions app/etc/vendor_path.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* Path to Composer vendor directory
*/
return 'vendor';
return './vendor';
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"magento/zendframework1": "1.12.10",
"composer/composer": "1.0.0-alpha8",
"monolog/monolog": "1.11.0",
"tubalmartin/cssmin": "2.4.8-p4"
"tubalmartin/cssmin": "2.4.8-p4",
"magento/magento-composer-installer": "*"
},
"require-dev": {
"phpunit/phpunit": "4.1.0",
Expand Down Expand Up @@ -194,7 +195,8 @@
},
"autoload": {
"psr-4": {
"Magento\\Framework\\": "lib/internal/Magento/Framework/"
"Magento\\Framework\\": "lib/internal/Magento/Framework/",
"Magento\\Setup\\": "setup/src/Magento/Setup/"
}
},
"autoload-dev": {
Expand All @@ -204,8 +206,7 @@
"Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
"Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
"Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/",
"Magento\\ToolkitFramework\\": "dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/",
"Magento\\Setup\\": "setup/src/Magento/Setup/"
"Magento\\ToolkitFramework\\": "dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/"
}
}
}
78 changes: 77 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 26 additions & 24 deletions dev/tools/Magento/Tools/View/deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
define('USAGE', "USAGE:\n\tphp -f {$baseName} -- [--langs=en_US,de_DE,...] [--verbose=0|1] [--dry-run] [--help]\n");
require __DIR__ . '/../../../../../app/bootstrap.php';

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

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

// run the deployment logic
$filesUtil = new \Magento\Framework\App\Utility\Files(BP);
$omFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, []);
$objectManager = $omFactory->create(
[\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_DEFAULT]
);
try {
// run the deployment logic
$filesUtil = new \Magento\Framework\Test\Utility\Files(BP);
$omFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, []);
$objectManager = $omFactory->create(
[\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_DEFAULT]
);

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

$logger = new \Magento\Tools\View\Deployer\Log($verbosity);
/** @var \Magento\Tools\View\Deployer $deployer */
$deployer = $objectManager->create(
'Magento\Tools\View\Deployer',
['filesUtil' => $filesUtil, 'logger' => $logger, 'isDryRun' => $isDryRun]
);
$deployer->deploy($omFactory, $langs);
exit(0);
/** @var \Magento\Tools\View\Deployer $deployer */
$deployer = $objectManager->create(
'Magento\Tools\View\Deployer',
['filesUtil' => $filesUtil, 'logger' => $logger, 'isDryRun' => $isDryRun]
);
$deployer->deploy($omFactory, $langs);
} catch (\Exception $e) {
$logger->logError($e->getMessage());
$logger->logDebug($e->getTraceAsString());
exit(1);
}
2 changes: 2 additions & 0 deletions lib/internal/Magento/Framework/App/StaticResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public function __construct(
*/
public function launch()
{
// disabling profiling when retrieving static resource
\Magento\Framework\Profiler::reset();
$appMode = $this->state->getMode();
if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) {
$this->response->setHttpResponseCode(404);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Framework\Module\ModuleList;

/**
* Factory for Deployment configuration segment for modules
*/
class DeploymentConfigFactory
{
/**
* Factory method for Deployment Config object
*
* @param array $data
* @return DeploymentConfig
*/
public function create(array $data)
{
return new DeploymentConfig($data);
}
}
17 changes: 15 additions & 2 deletions lib/internal/Magento/Framework/Module/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
namespace Magento\Framework\Module;

use Magento\Framework\App\DeploymentConfig\Writer;
use Magento\Framework\Module\ModuleList\DeploymentConfigFactory;
use Magento\Framework\App\State\Cleanup;

/**
* A service for controlling module status
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Status
{
Expand Down Expand Up @@ -56,6 +59,13 @@ class Status
*/
private $conflictChecker;

/**
* Factory to create module deployment config object
*
* @var DeploymentConfigFactory
*/
private $deploymentConfigFactory;

/**
* Constructor
*
Expand All @@ -65,21 +75,24 @@ class Status
* @param Cleanup $cleanup
* @param ConflictChecker $conflictChecker
* @param DependencyChecker $dependencyChecker
* @param DeploymentConfigFactory $deploymentConfigFactory
*/
public function __construct(
ModuleList\Loader $loader,
ModuleList $list,
Writer $writer,
Cleanup $cleanup,
ConflictChecker $conflictChecker,
DependencyChecker $dependencyChecker
DependencyChecker $dependencyChecker,
DeploymentConfigFactory $deploymentConfigFactory
) {
$this->loader = $loader;
$this->list = $list;
$this->writer = $writer;
$this->cleanup = $cleanup;
$this->conflictChecker = $conflictChecker;
$this->dependencyChecker = $dependencyChecker;
$this->deploymentConfigFactory = $deploymentConfigFactory;
}

/**
Expand Down Expand Up @@ -159,7 +172,7 @@ public function setIsEnabled($isEnabled, $modules)
$result[$name] = $currentStatus;
}
}
$segment = new ModuleList\DeploymentConfig($result);
$segment = $this->deploymentConfigFactory->create($result);
$this->writer->update($segment);
$this->cleanup->clearCaches();
$this->cleanup->clearCodeGeneratedFiles();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Framework\Module\Test\Unit\ModuleList;

use Magento\Framework\Module\ModuleList\DeploymentConfigFactory;

class DeploymentConfigFactoryTest extends \PHPUnit_Framework_TestCase
{
/**
* @var DeploymentConfigFactory
*/
protected $object;

public function testCreate()
{
$this->object = new DeploymentConfigFactory();
$this->assertInstanceOf(
'Magento\Framework\Module\ModuleList\DeploymentConfig',
$this->object->create(['Module_One' => 0, 'Module_Two' =>1])
);
}
}
24 changes: 19 additions & 5 deletions lib/internal/Magento/Framework/Module/Test/Unit/StatusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class StatusTest extends \PHPUnit_Framework_TestCase
*/
private $dependencyChecker;

/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
private $deploymentConfigFactory;

/**
* @var Status
*/
Expand All @@ -53,13 +58,21 @@ protected function setUp()
$this->cleanup = $this->getMock('Magento\Framework\App\State\Cleanup', [], [], '', false);
$this->conflictChecker = $this->getMock('Magento\Framework\Module\ConflictChecker', [], [], '', false);
$this->dependencyChecker = $this->getMock('Magento\Framework\Module\DependencyChecker', [], [], '', false);
$this->deploymentConfigFactory = $this->getMock(
'Magento\Framework\Module\ModuleList\DeploymentConfigFactory',
[],
[],
'',
false
);
$this->object = new Status(
$this->loader,
$this->moduleList,
$this->writer,
$this->cleanup,
$this->conflictChecker,
$this->dependencyChecker
$this->dependencyChecker,
$this->deploymentConfigFactory
);
}

Expand Down Expand Up @@ -167,10 +180,11 @@ public function testSetIsEnabled()
$this->moduleList->expects($this->at(0))->method('has')->with('Module_Foo')->willReturn(false);
$this->moduleList->expects($this->at(1))->method('has')->with('Module_Bar')->willReturn(false);
$this->moduleList->expects($this->at(2))->method('has')->with('Module_Baz')->willReturn(false);
$constraint = new \PHPUnit_Framework_Constraint_IsInstanceOf(
'Magento\Framework\Module\ModuleList\DeploymentConfig'
);
$this->writer->expects($this->once())->method('update')->with($constraint);
$deploymentConfig = $this->getMock('Magento\Framework\Module\ModuleList\DeploymentConfig', [], [], '', false);
$expectedModules = ['Module_Foo' => 1, 'Module_Bar' => 1, 'Module_Baz' => 0];
$this->deploymentConfigFactory->expects($this->once())->method('create')->with($expectedModules)
->willReturn($deploymentConfig);
$this->writer->expects($this->once())->method('update')->with($deploymentConfig);
$this->cleanup->expects($this->once())->method('clearCaches');
$this->cleanup->expects($this->once())->method('clearCodeGeneratedFiles');
$this->object->setIsEnabled(true, ['Module_Foo', 'Module_Bar']);
Expand Down
5 changes: 4 additions & 1 deletion setup/pub/magento/setup/add-database.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ angular.module('add-database', ['ngStorage'])
$http.post('index.php/database-check', $scope.db)
.success(function (data) {
$scope.testConnection.result = data;
if (!(($scope.testConnection.result !== undefined) && (!$scope.testConnection.result.success))) {
if ($scope.testConnection.result.success) {
$scope.nextState();
}
})
.error(function (data) {
$scope.testConnection.failed = data;
});
};

Expand Down
Loading

0 comments on commit cef92a1

Please sign in to comment.