Skip to content

Commit fadbca6

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-35616
2 parents 1baf91c + f044f59 commit fadbca6

File tree

343 files changed

+5417
-1567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

343 files changed

+5417
-1567
lines changed

CHANGELOG.md

Lines changed: 101 additions & 91 deletions
Large diffs are not rendered by default.

Gruntfile.js

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,24 @@ module.exports = function (grunt) {
88
'use strict';
99

1010
var _ = require('underscore'),
11-
path = require('path');
11+
path = require('path'),
12+
configDir = './dev/tools/grunt/configs',
13+
taskDir = './dev/tools/grunt/tasks';
1214

13-
require('./dev/tools/grunt/tasks/mage-minify')(grunt);
14-
require('time-grunt')(grunt);
15+
[
16+
taskDir + '/mage-minify',
17+
taskDir + '/deploy',
18+
'time-grunt'
19+
].forEach(function (task) {
20+
require(task)(grunt);
21+
});
1522

1623
require('load-grunt-config')(grunt, {
17-
configPath: path.join(process.cwd(), 'dev/tools/grunt/configs'),
24+
configPath: path.join(__dirname, configDir),
1825
init: true,
1926
loadGruntTasks: {
2027
pattern: [
21-
'grunt-*',
22-
'!grunt-template-jasmine-requirejs'
28+
'grunt-*'
2329
]
2430
}
2531
});
@@ -70,24 +76,6 @@ module.exports = function (grunt) {
7076
'clean:pub'
7177
],
7278

73-
spec: [
74-
'specRunner:lib',
75-
'specRunner:backend',
76-
'specRunner:frontend'
77-
],
78-
79-
unit: [
80-
'jasmine:lib-unit',
81-
'jasmine:backend-unit',
82-
'jasmine:frontend-unit'
83-
],
84-
85-
integration: [
86-
'jasmine:lib-integration',
87-
'jasmine:backend-integration',
88-
'jasmine:frontend-integration'
89-
],
90-
9179
'legacy-build': [
9280
'mage-minify:legacy'
9381
],
@@ -96,7 +84,15 @@ module.exports = function (grunt) {
9684
'usebanner:documentationCss',
9785
'usebanner:documentationLess',
9886
'usebanner:documentationHtml'
99-
]
87+
],
88+
89+
spec: function (theme) {
90+
var runner = require('./dev/tests/js/jasmine/spec_runner');
91+
92+
runner.init(grunt, { theme: theme });
93+
94+
grunt.task.run(runner.getTasks());
95+
}
10096
}, function (task, name) {
10197
grunt.registerTask(name, task);
10298
});

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Use the following table to verify you have the correct prerequisites to install
2727
</tr>
2828
<tr>
2929
<td>Apache 2.2 or 2.4</td>
30-
<td>Ubuntu: <code>apache -v</code><br>
30+
<td>Ubuntu: <code>apache2 -v</code><br>
3131
CentOS: <code>httpd -v</code></td>
3232
<td><a href="http://devdocs.magento.com/guides/v1.0/install-gde/prereq/apache.html">Apache</a></td>
3333
</tr>
@@ -57,3 +57,17 @@ After verifying your prerequisites, perform the following tasks in order to prep
5757
* <a href="http://devdocs.magento.com/guides/v1.0/install-gde/install/install-web.html">Install Magento software using the web interface</a>
5858
* <a href="http://devdocs.magento.com/guides/v1.0/install-gde/install/install-cli.html">Install Magento software using the command line</a>
5959
2. <a href="http://devdocs.magento.com/guides/v1.0/install-gde/install/verify.html">Verify the installation</a>
60+
61+
<h2>Contributing to the Magento 2 code base</h2>
62+
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.
63+
64+
To make learn about how to make a contribution, click [here][1].
65+
66+
To learn about issues, click [here][2]. To open an issue, click [here][3].
67+
68+
To suggest documentation improvements, click [here][4].
69+
70+
[1]: <http://devdocs.magento.com/guides/v1.0/contributor-guide/CONTRIBUTING.html>
71+
[2]: <http://devdocs.magento.com/guides/v1.0/contributor-guide/CONTRIBUTING.html#report>
72+
[3]: <https://github.com/magento/magento2/issues>
73+
[4]: <http://devdocs.magento.com>

app/code/Magento/AdminNotification/composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"description": "N/A",
44
"require": {
55
"php": "~5.5.0|~5.6.0",
6-
"magento/module-store": "0.74.0-beta1",
7-
"magento/module-backend": "0.74.0-beta1",
8-
"magento/module-media-storage": "0.74.0-beta1",
9-
"magento/framework": "0.74.0-beta1",
6+
"magento/module-store": "0.74.0-beta2",
7+
"magento/module-backend": "0.74.0-beta2",
8+
"magento/module-media-storage": "0.74.0-beta2",
9+
"magento/framework": "0.74.0-beta2",
1010
"lib-libxml": "*",
1111
"magento/magento-composer-installer": "*"
1212
},
1313
"type": "magento2-module",
14-
"version": "0.74.0-beta1",
14+
"version": "0.74.0-beta2",
1515
"license": [
1616
"OSL-3.0",
1717
"AFL-3.0"

app/code/Magento/Authorization/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"description": "Authorization module provides access to Magento ACL functionality.",
44
"require": {
55
"php": "~5.5.0|~5.6.0",
6-
"magento/module-backend": "0.74.0-beta1",
7-
"magento/framework": "0.74.0-beta1",
6+
"magento/module-backend": "0.74.0-beta2",
7+
"magento/framework": "0.74.0-beta2",
88
"magento/magento-composer-installer": "*"
99
},
1010
"type": "magento2-module",
11-
"version": "0.74.0-beta1",
11+
"version": "0.74.0-beta2",
1212
"license": [
1313
"OSL-3.0",
1414
"AFL-3.0"

app/code/Magento/Backend/Model/Auth.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function setAuthStorage($storage)
9393
* If auth storage was not defined outside - returns default object of auth storage
9494
*
9595
* @return \Magento\Backend\Model\Auth\StorageInterface
96+
* @codeCoverageIgnore
9697
*/
9798
public function getAuthStorage()
9899
{
@@ -126,6 +127,7 @@ protected function _initCredentialStorage()
126127
* Return credential storage object
127128
*
128129
* @return null|\Magento\Backend\Model\Auth\Credential\StorageInterface
130+
* @codeCoverageIgnore
129131
*/
130132
public function getCredentialStorage()
131133
{

app/code/Magento/Backend/Model/Auth/Session.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ public function processLogout()
253253
* @param string $path
254254
* @return bool
255255
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
256+
* @codeCoverageIgnore
256257
*/
257258
public function isValidForPath($path)
258259
{

app/code/Magento/Backend/Model/Search/Order.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,7 @@ public function load()
7676
'id' => 'order/1/' . $order->getId(),
7777
'type' => __('Order'),
7878
'name' => __('Order #%1', $order->getIncrementId()),
79-
'description' => $order->getBillingFirstname() . ' ' . $order->getBillingLastname(),
80-
'form_panel_title' => __(
81-
'Order #%1 (%2)',
82-
$order->getIncrementId(),
83-
$order->getBillingFirstname() . ' ' . $order->getBillingLastname()
84-
),
79+
'description' => $order->getFirstname() . ' ' . $order->getLastname(),
8580
'url' => $this->_adminhtmlData->getUrl('sales/order/view', ['order_id' => $order->getId()]),
8681
];
8782
}

app/code/Magento/Backend/Test/Unit/Model/Auth/SessionTest.php

Lines changed: 105 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class SessionTest extends \PHPUnit_Framework_TestCase
3838
*/
3939
protected $storage;
4040

41+
/**
42+
* @var \Magento\Framework\Acl\Builder | \PHPUnit_Framework_MockObject_MockObject
43+
*/
44+
protected $aclBuilder;
45+
4146
/**
4247
* @var Session
4348
*/
@@ -61,14 +66,23 @@ protected function setUp()
6166
'',
6267
false
6368
);
64-
$this->storage = $this->getMock('Magento\Framework\Session\Storage', ['getUser'], [], '', false);
69+
$this->storage = $this->getMock(
70+
'Magento\Framework\Session\Storage',
71+
['getUser', 'getAcl', 'setAcl'],
72+
[],
73+
'',
74+
false
75+
);
6576
$this->sessionConfig = $this->getMock(
6677
'Magento\Framework\Session\Config',
6778
['getCookiePath', 'getCookieDomain', 'getCookieSecure', 'getCookieHttpOnly'],
6879
[],
6980
'',
7081
false
7182
);
83+
$this->aclBuilder = $this->getMockBuilder('Magento\Framework\Acl\Builder')
84+
->disableOriginalConstructor()
85+
->getMock();
7286
$objectManager = new ObjectManager($this);
7387
$this->session = $objectManager->getObject(
7488
'Magento\Backend\Model\Auth\Session',
@@ -77,7 +91,8 @@ protected function setUp()
7791
'sessionConfig' => $this->sessionConfig,
7892
'cookieManager' => $this->cookieManager,
7993
'cookieMetadataFactory' => $this->cookieMetadataFactory,
80-
'storage' => $this->storage
94+
'storage' => $this->storage,
95+
'aclBuilder' => $this->aclBuilder
8196
]
8297
);
8398
}
@@ -89,6 +104,40 @@ protected function tearDown()
89104
$this->session = null;
90105
}
91106

107+
/**
108+
* @dataProvider refreshAclDataProvider
109+
* @param $isUserPassedViaParams
110+
*/
111+
public function testRefreshAcl($isUserPassedViaParams)
112+
{
113+
$aclMock = $this->getMockBuilder('Magento\Framework\Acl')->disableOriginalConstructor()->getMock();
114+
$this->aclBuilder->expects($this->any())->method('getAcl')->willReturn($aclMock);
115+
$userMock = $this->getMockBuilder('Magento\User\Model\User')
116+
->setMethods(['getReloadAclFlag', 'setReloadAclFlag', 'unsetData', 'save'])
117+
->disableOriginalConstructor()
118+
->getMock();
119+
$userMock->expects($this->any())->method('getReloadAclFlag')->willReturn(true);
120+
$userMock->expects($this->once())->method('setReloadAclFlag')->with('0')->willReturnSelf();
121+
$userMock->expects($this->once())->method('save');
122+
$this->storage->expects($this->once())->method('setAcl')->with($aclMock);
123+
$this->storage->expects($this->any())->method('getAcl')->willReturn($aclMock);
124+
if ($isUserPassedViaParams) {
125+
$this->session->refreshAcl($userMock);
126+
} else {
127+
$this->storage->expects($this->once())->method('getUser')->willReturn($userMock);
128+
$this->session->refreshAcl();
129+
}
130+
$this->assertSame($aclMock, $this->session->getAcl());
131+
}
132+
133+
public function refreshAclDataProvider()
134+
{
135+
return [
136+
'User set via params' => [true],
137+
'User set to session object' => [false]
138+
];
139+
}
140+
92141
public function testIsLoggedInPositive()
93142
{
94143
$lifetime = 900;
@@ -176,4 +225,58 @@ public function testProlong()
176225

177226
$this->assertLessThanOrEqual(time(), $this->session->getUpdatedAt());
178227
}
228+
229+
/**
230+
* @dataProvider isAllowedDataProvider
231+
* @param bool $isUserDefined
232+
* @param bool $isAclDefined
233+
* @param bool $isAllowed
234+
* @param true $expectedResult
235+
*/
236+
public function testIsAllowed($isUserDefined, $isAclDefined, $isAllowed, $expectedResult)
237+
{
238+
$userAclRole = 'userAclRole';
239+
if ($isAclDefined) {
240+
$aclMock = $this->getMockBuilder('Magento\Framework\Acl')->disableOriginalConstructor()->getMock();
241+
$this->storage->expects($this->any())->method('getAcl')->willReturn($aclMock);
242+
}
243+
if ($isUserDefined) {
244+
$userMock = $this->getMockBuilder('Magento\User\Model\User')->disableOriginalConstructor()->getMock();
245+
$this->storage->expects($this->once())->method('getUser')->willReturn($userMock);
246+
}
247+
if ($isAclDefined && $isUserDefined) {
248+
$userMock->expects($this->any())->method('getAclRole')->willReturn($userAclRole);
249+
$aclMock->expects($this->once())->method('isAllowed')->with($userAclRole)->willReturn($isAllowed);
250+
}
251+
252+
$this->assertEquals($expectedResult, $this->session->isAllowed('resource'));
253+
}
254+
255+
public function isAllowedDataProvider()
256+
{
257+
return [
258+
"Negative: User not defined" => [false, true, true, false],
259+
"Negative: Acl not defined" => [true, false, true, false],
260+
"Negative: Permission denied" => [true, true, false, false],
261+
"Positive: Permission granted" => [true, true, false, false],
262+
];
263+
}
264+
265+
/**
266+
* @dataProvider firstPageAfterLoginDataProvider
267+
* @param bool $isFirstPageAfterLogin
268+
*/
269+
public function testFirstPageAfterLogin($isFirstPageAfterLogin)
270+
{
271+
$this->session->setIsFirstPageAfterLogin($isFirstPageAfterLogin);
272+
$this->assertEquals($isFirstPageAfterLogin, $this->session->isFirstPageAfterLogin());
273+
}
274+
275+
public function firstPageAfterLoginDataProvider()
276+
{
277+
return [
278+
'First page after login' => [true],
279+
'Not first page after login' => [false],
280+
];
281+
}
179282
}

app/code/Magento/Backend/composer.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
"description": "N/A",
44
"require": {
55
"php": "~5.5.0|~5.6.0",
6-
"magento/module-store": "0.74.0-beta1",
7-
"magento/module-directory": "0.74.0-beta1",
8-
"magento/module-developer": "0.74.0-beta1",
9-
"magento/module-eav": "0.74.0-beta1",
10-
"magento/module-cron": "0.74.0-beta1",
11-
"magento/module-theme": "0.74.0-beta1",
12-
"magento/module-reports": "0.74.0-beta1",
13-
"magento/module-sales": "0.74.0-beta1",
14-
"magento/module-quote": "0.74.0-beta1",
15-
"magento/module-catalog": "0.74.0-beta1",
16-
"magento/module-user": "0.74.0-beta1",
17-
"magento/module-backup": "0.74.0-beta1",
18-
"magento/module-customer": "0.74.0-beta1",
19-
"magento/module-translation": "0.74.0-beta1",
20-
"magento/module-require-js": "0.74.0-beta1",
21-
"magento/module-config": "0.74.0-beta1",
22-
"magento/framework": "0.74.0-beta1",
6+
"magento/module-store": "0.74.0-beta2",
7+
"magento/module-directory": "0.74.0-beta2",
8+
"magento/module-developer": "0.74.0-beta2",
9+
"magento/module-eav": "0.74.0-beta2",
10+
"magento/module-cron": "0.74.0-beta2",
11+
"magento/module-theme": "0.74.0-beta2",
12+
"magento/module-reports": "0.74.0-beta2",
13+
"magento/module-sales": "0.74.0-beta2",
14+
"magento/module-quote": "0.74.0-beta2",
15+
"magento/module-catalog": "0.74.0-beta2",
16+
"magento/module-user": "0.74.0-beta2",
17+
"magento/module-backup": "0.74.0-beta2",
18+
"magento/module-customer": "0.74.0-beta2",
19+
"magento/module-translation": "0.74.0-beta2",
20+
"magento/module-require-js": "0.74.0-beta2",
21+
"magento/module-config": "0.74.0-beta2",
22+
"magento/framework": "0.74.0-beta2",
2323
"magento/magento-composer-installer": "*"
2424
},
2525
"type": "magento2-module",
26-
"version": "0.74.0-beta1",
26+
"version": "0.74.0-beta2",
2727
"license": [
2828
"OSL-3.0",
2929
"AFL-3.0"

0 commit comments

Comments
 (0)