Skip to content

Commit

Permalink
Merge branch 'develop' into MAGETWO-34645
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro Voskoboinikov committed Apr 1, 2015
2 parents b1bad92 + f9966b1 commit fa29532
Show file tree
Hide file tree
Showing 457 changed files with 9,524 additions and 3,911 deletions.
192 changes: 101 additions & 91 deletions CHANGELOG.md

Large diffs are not rendered by default.

46 changes: 21 additions & 25 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@ module.exports = function (grunt) {
'use strict';

var _ = require('underscore'),
path = require('path');
path = require('path'),
configDir = './dev/tools/grunt/configs',
taskDir = './dev/tools/grunt/tasks';

require('./dev/tools/grunt/tasks/mage-minify')(grunt);
require('time-grunt')(grunt);
[
taskDir + '/mage-minify',
taskDir + '/deploy',
'time-grunt'
].forEach(function (task) {
require(task)(grunt);
});

require('load-grunt-config')(grunt, {
configPath: path.join(process.cwd(), 'dev/tools/grunt/configs'),
configPath: path.join(__dirname, configDir),
init: true,
loadGruntTasks: {
pattern: [
'grunt-*',
'!grunt-template-jasmine-requirejs'
'grunt-*'
]
}
});
Expand Down Expand Up @@ -78,24 +84,6 @@ module.exports = function (grunt) {
'clean:pub'
],

spec: [
'specRunner:lib',
'specRunner:backend',
'specRunner:frontend'
],

unit: [
'jasmine:lib-unit',
'jasmine:backend-unit',
'jasmine:frontend-unit'
],

integration: [
'jasmine:lib-integration',
'jasmine:backend-integration',
'jasmine:frontend-integration'
],

'legacy-build': [
'mage-minify:legacy'
],
Expand All @@ -104,7 +92,15 @@ module.exports = function (grunt) {
'usebanner:documentationCss',
'usebanner:documentationLess',
'usebanner:documentationHtml'
]
],

spec: function (theme) {
var runner = require('./dev/tests/js/jasmine/spec_runner');

runner.init(grunt, { theme: theme });

grunt.task.run(runner.getTasks());
}
}, function (task, name) {
grunt.registerTask(name, task);
});
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/AdminNotification/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0",
"magento/module-store": "0.74.0-beta1",
"magento/module-backend": "0.74.0-beta1",
"magento/module-media-storage": "0.74.0-beta1",
"magento/framework": "0.74.0-beta1",
"magento/module-store": "0.74.0-beta2",
"magento/module-backend": "0.74.0-beta2",
"magento/module-media-storage": "0.74.0-beta2",
"magento/framework": "0.74.0-beta2",
"lib-libxml": "*",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
"version": "0.74.0-beta1",
"version": "0.74.0-beta2",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Authorization/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"description": "Authorization module provides access to Magento ACL functionality.",
"require": {
"php": "~5.5.0|~5.6.0",
"magento/module-backend": "0.74.0-beta1",
"magento/framework": "0.74.0-beta1",
"magento/module-backend": "0.74.0-beta2",
"magento/framework": "0.74.0-beta2",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
"version": "0.74.0-beta1",
"version": "0.74.0-beta2",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Backend/Model/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function setAuthStorage($storage)
* If auth storage was not defined outside - returns default object of auth storage
*
* @return \Magento\Backend\Model\Auth\StorageInterface
* @codeCoverageIgnore
*/
public function getAuthStorage()
{
Expand Down Expand Up @@ -126,6 +127,7 @@ protected function _initCredentialStorage()
* Return credential storage object
*
* @return null|\Magento\Backend\Model\Auth\Credential\StorageInterface
* @codeCoverageIgnore
*/
public function getCredentialStorage()
{
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Backend/Model/Auth/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ public function processLogout()
* @param string $path
* @return bool
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @codeCoverageIgnore
*/
public function isValidForPath($path)
{
Expand Down
7 changes: 1 addition & 6 deletions app/code/Magento/Backend/Model/Search/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,7 @@ public function load()
'id' => 'order/1/' . $order->getId(),
'type' => __('Order'),
'name' => __('Order #%1', $order->getIncrementId()),
'description' => $order->getBillingFirstname() . ' ' . $order->getBillingLastname(),
'form_panel_title' => __(
'Order #%1 (%2)',
$order->getIncrementId(),
$order->getBillingFirstname() . ' ' . $order->getBillingLastname()
),
'description' => $order->getFirstname() . ' ' . $order->getLastname(),
'url' => $this->_adminhtmlData->getUrl('sales/order/view', ['order_id' => $order->getId()]),
];
}
Expand Down
107 changes: 105 additions & 2 deletions app/code/Magento/Backend/Test/Unit/Model/Auth/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class SessionTest extends \PHPUnit_Framework_TestCase
*/
protected $storage;

/**
* @var \Magento\Framework\Acl\Builder | \PHPUnit_Framework_MockObject_MockObject
*/
protected $aclBuilder;

/**
* @var Session
*/
Expand All @@ -61,14 +66,23 @@ protected function setUp()
'',
false
);
$this->storage = $this->getMock('Magento\Framework\Session\Storage', ['getUser'], [], '', false);
$this->storage = $this->getMock(
'Magento\Framework\Session\Storage',
['getUser', 'getAcl', 'setAcl'],
[],
'',
false
);
$this->sessionConfig = $this->getMock(
'Magento\Framework\Session\Config',
['getCookiePath', 'getCookieDomain', 'getCookieSecure', 'getCookieHttpOnly'],
[],
'',
false
);
$this->aclBuilder = $this->getMockBuilder('Magento\Framework\Acl\Builder')
->disableOriginalConstructor()
->getMock();
$objectManager = new ObjectManager($this);
$this->session = $objectManager->getObject(
'Magento\Backend\Model\Auth\Session',
Expand All @@ -77,7 +91,8 @@ protected function setUp()
'sessionConfig' => $this->sessionConfig,
'cookieManager' => $this->cookieManager,
'cookieMetadataFactory' => $this->cookieMetadataFactory,
'storage' => $this->storage
'storage' => $this->storage,
'aclBuilder' => $this->aclBuilder
]
);
}
Expand All @@ -89,6 +104,40 @@ protected function tearDown()
$this->session = null;
}

/**
* @dataProvider refreshAclDataProvider
* @param $isUserPassedViaParams
*/
public function testRefreshAcl($isUserPassedViaParams)
{
$aclMock = $this->getMockBuilder('Magento\Framework\Acl')->disableOriginalConstructor()->getMock();
$this->aclBuilder->expects($this->any())->method('getAcl')->willReturn($aclMock);
$userMock = $this->getMockBuilder('Magento\User\Model\User')
->setMethods(['getReloadAclFlag', 'setReloadAclFlag', 'unsetData', 'save'])
->disableOriginalConstructor()
->getMock();
$userMock->expects($this->any())->method('getReloadAclFlag')->willReturn(true);
$userMock->expects($this->once())->method('setReloadAclFlag')->with('0')->willReturnSelf();
$userMock->expects($this->once())->method('save');
$this->storage->expects($this->once())->method('setAcl')->with($aclMock);
$this->storage->expects($this->any())->method('getAcl')->willReturn($aclMock);
if ($isUserPassedViaParams) {
$this->session->refreshAcl($userMock);
} else {
$this->storage->expects($this->once())->method('getUser')->willReturn($userMock);
$this->session->refreshAcl();
}
$this->assertSame($aclMock, $this->session->getAcl());
}

public function refreshAclDataProvider()
{
return [
'User set via params' => [true],
'User set to session object' => [false]
];
}

public function testIsLoggedInPositive()
{
$lifetime = 900;
Expand Down Expand Up @@ -176,4 +225,58 @@ public function testProlong()

$this->assertLessThanOrEqual(time(), $this->session->getUpdatedAt());
}

/**
* @dataProvider isAllowedDataProvider
* @param bool $isUserDefined
* @param bool $isAclDefined
* @param bool $isAllowed
* @param true $expectedResult
*/
public function testIsAllowed($isUserDefined, $isAclDefined, $isAllowed, $expectedResult)
{
$userAclRole = 'userAclRole';
if ($isAclDefined) {
$aclMock = $this->getMockBuilder('Magento\Framework\Acl')->disableOriginalConstructor()->getMock();
$this->storage->expects($this->any())->method('getAcl')->willReturn($aclMock);
}
if ($isUserDefined) {
$userMock = $this->getMockBuilder('Magento\User\Model\User')->disableOriginalConstructor()->getMock();
$this->storage->expects($this->once())->method('getUser')->willReturn($userMock);
}
if ($isAclDefined && $isUserDefined) {
$userMock->expects($this->any())->method('getAclRole')->willReturn($userAclRole);
$aclMock->expects($this->once())->method('isAllowed')->with($userAclRole)->willReturn($isAllowed);
}

$this->assertEquals($expectedResult, $this->session->isAllowed('resource'));
}

public function isAllowedDataProvider()
{
return [
"Negative: User not defined" => [false, true, true, false],
"Negative: Acl not defined" => [true, false, true, false],
"Negative: Permission denied" => [true, true, false, false],
"Positive: Permission granted" => [true, true, false, false],
];
}

/**
* @dataProvider firstPageAfterLoginDataProvider
* @param bool $isFirstPageAfterLogin
*/
public function testFirstPageAfterLogin($isFirstPageAfterLogin)
{
$this->session->setIsFirstPageAfterLogin($isFirstPageAfterLogin);
$this->assertEquals($isFirstPageAfterLogin, $this->session->isFirstPageAfterLogin());
}

public function firstPageAfterLoginDataProvider()
{
return [
'First page after login' => [true],
'Not first page after login' => [false],
];
}
}
36 changes: 18 additions & 18 deletions app/code/Magento/Backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0",
"magento/module-store": "0.74.0-beta1",
"magento/module-directory": "0.74.0-beta1",
"magento/module-developer": "0.74.0-beta1",
"magento/module-eav": "0.74.0-beta1",
"magento/module-cron": "0.74.0-beta1",
"magento/module-theme": "0.74.0-beta1",
"magento/module-reports": "0.74.0-beta1",
"magento/module-sales": "0.74.0-beta1",
"magento/module-quote": "0.74.0-beta1",
"magento/module-catalog": "0.74.0-beta1",
"magento/module-user": "0.74.0-beta1",
"magento/module-backup": "0.74.0-beta1",
"magento/module-customer": "0.74.0-beta1",
"magento/module-translation": "0.74.0-beta1",
"magento/module-require-js": "0.74.0-beta1",
"magento/module-config": "0.74.0-beta1",
"magento/framework": "0.74.0-beta1",
"magento/module-store": "0.74.0-beta2",
"magento/module-directory": "0.74.0-beta2",
"magento/module-developer": "0.74.0-beta2",
"magento/module-eav": "0.74.0-beta2",
"magento/module-cron": "0.74.0-beta2",
"magento/module-theme": "0.74.0-beta2",
"magento/module-reports": "0.74.0-beta2",
"magento/module-sales": "0.74.0-beta2",
"magento/module-quote": "0.74.0-beta2",
"magento/module-catalog": "0.74.0-beta2",
"magento/module-user": "0.74.0-beta2",
"magento/module-backup": "0.74.0-beta2",
"magento/module-customer": "0.74.0-beta2",
"magento/module-translation": "0.74.0-beta2",
"magento/module-require-js": "0.74.0-beta2",
"magento/module-config": "0.74.0-beta2",
"magento/framework": "0.74.0-beta2",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
"version": "0.74.0-beta1",
"version": "0.74.0-beta2",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<default>
<dev>
<template>
<minify_html>1</minify_html>
<minify_html>0</minify_html>
</template>
</dev>
<system>
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Backup/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0",
"magento/module-store": "0.74.0-beta1",
"magento/module-backend": "0.74.0-beta1",
"magento/module-cron": "0.74.0-beta1",
"magento/framework": "0.74.0-beta1",
"magento/module-store": "0.74.0-beta2",
"magento/module-backend": "0.74.0-beta2",
"magento/module-cron": "0.74.0-beta2",
"magento/framework": "0.74.0-beta2",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
"version": "0.74.0-beta1",
"version": "0.74.0-beta2",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
Loading

0 comments on commit fa29532

Please sign in to comment.