Skip to content

Commit 0b53817

Browse files
committed
Merge remote-tracking branch 'origin/analytics-sprint-3' into analytics-sprint-3
2 parents 69b6655 + bc7ff43 commit 0b53817

File tree

250 files changed

+8678
-1583
lines changed

Some content is hidden

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

250 files changed

+8678
-1583
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ addons:
99
- postfix
1010
language: php
1111
php:
12-
- 5.6
12+
- 5.6.29
1313
- 7.0
1414
env:
1515
global:

README.md

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,14 @@
33
<h2>Welcome</h2>
44
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting edge, feature-rich eCommerce solution that gets results.
55

6-
The installation instructions that used to be here are now published on our GitHub site. Use the information on this page to get started or go directly to the <a href="http://devdocs.magento.com/guides/v2.0/install-gde/bk-install-guide.html" target="_blank">guide</a>.
6+
## Magento system requirements
7+
[Magento system requirements](http://devdocs.magento.com/magento-system-requirements.html)
78

8-
<h2>New to Magento? Need some help?</h2>
9-
If you're not sure about the following, you probably need a little help before you start installing the Magento software:
9+
## Install Magento
10+
To install Magento, see either:
1011

11-
* Is the Magento software <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_magento-installed.html">installed already</a>?
12-
* What's a <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_login.html">terminal, command prompt, or Secure Shell (ssh)</a>?
13-
* Where's my <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_login.html">Magento server</a> and how do I access it?
14-
* What's <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_software.html">PHP</a>?
15-
* What's <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_software.html">Apache</a>?
16-
* What's <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_software.html">MySQL</a>?
17-
18-
<h2>Step 1: Verify your prerequisites</h2>
19-
20-
Use the following table to verify you have the correct prerequisites to install the Magento software.
21-
22-
<table>
23-
<tbody>
24-
<tr>
25-
<th>Prerequisite</th>
26-
<th>How to check</th>
27-
<th>For more information</th>
28-
</tr>
29-
<tr>
30-
<td>Apache 2.2 or 2.4</td>
31-
<td>Ubuntu: <code>apache2 -v</code><br>
32-
CentOS: <code>httpd -v</code></td>
33-
<td><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache.html">Apache</a></td>
34-
</tr>
35-
<tr>
36-
<td>PHP 5.6.x, 7.0.2, 7.0.4 or 7.0.6</td>
37-
<td><code>php -v</code></td>
38-
<td><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-ubuntu.html">PHP Ubuntu</a><br><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-centos.html">PHP CentOS</a></td>
39-
</tr>
40-
<tr><td>MySQL 5.6.x</td>
41-
<td><code>mysql -u [root user name] -p</code></td>
42-
<td><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/mysql.html">MySQL</a></td>
43-
</tr>
44-
</tbody>
45-
</table>
46-
47-
<h2>Step 2: Prepare to install</h2>
48-
49-
After verifying your prerequisites, perform the following tasks in order to prepare to install the Magento software.
50-
51-
1. <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/composer-clone.html#instgde-prereq-compose-install">Install Composer</a>
52-
2. <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/composer-clone.html#instgde-prereq-compose-clone">Clone the Magento repository</a>
53-
54-
<h2>Step 3: Install and verify the installation</h2>
55-
56-
1. <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/prepare-install.html">Update installation dependencies</a>
57-
2. Install Magento:
58-
* <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/install-web.html">Install Magento software using the web interface</a>
59-
* <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/install-cli.html">Install Magento software using the command line</a>
60-
2. <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/verify.html">Verify the installation</a>
12+
* [Magento DevBox](https://magento.com/tech-resources/download), the easiest way to get started with Magento.
13+
* [Installation guide](http://devdocs.magento.com/guides/v2.0/install-gde/bk-install-guide.html)
6114

6215
<h2>Contributing to the Magento 2 code base</h2>
6316
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.

app/bootstrap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,7 @@
5858
}
5959

6060
date_default_timezone_set('UTC');
61+
62+
/* Adjustment of precision value for several versions of PHP */
63+
ini_set('precision', 17);
64+
ini_set('serialize_precision', 17);

app/code/Magento/Analytics/Model/Cryptographer.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,16 @@ public function encode($source)
8383
/**
8484
* Return key for encryption.
8585
*
86-
* Random initial value for key used in case of empty token value to prevent a vulnerability with a predicted key.
87-
*
8886
* @return string
87+
* @throws LocalizedException
8988
*/
9089
private function getKey()
9190
{
92-
return hash('sha256', $this->analyticsToken->getToken() ?: openssl_random_pseudo_bytes(256));
91+
$token = $this->analyticsToken->getToken();
92+
if (!$token) {
93+
throw new LocalizedException(__('Encryption key can\'t be empty.'));
94+
}
95+
return hash('sha256', $token);
9396
}
9497

9598
/**

app/code/Magento/Analytics/Model/FileRecorder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private function getFileRelativePath()
9696
* Register encoded file.
9797
*
9898
* @param EncodedContext $encodedContext
99-
* @param $fileRelativePath
99+
* @param string $fileRelativePath
100100
* @return bool
101101
*/
102102
private function registerFile(EncodedContext $encodedContext, $fileRelativePath)

app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/Client/CurlTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Analytics\Test\Unit\Model\Connector\Http\Client;
77

8+
use Magento\Framework\HTTP\Adapter\CurlFactory;
9+
810
/**
911
* A unit test for testing of the CURL HTTP client.
1012
*/
@@ -31,7 +33,7 @@ class CurlTest extends \PHPUnit_Framework_TestCase
3133
private $responseMock;
3234

3335
/**
34-
* @var \Magento\Framework\HTTP\Adapter\CurlFactory|\PHPUnit_Framework_MockObject_MockObject
36+
* @var CurlFactory|\PHPUnit_Framework_MockObject_MockObject
3537
*/
3638
private $curlFactoryMock;
3739

@@ -68,11 +70,10 @@ protected function setUp()
6870
->disableOriginalConstructor()
6971
->getMock();
7072

71-
$this->curlFactoryMock = $this->getMockBuilder(
72-
\Magento\Framework\HTTP\Adapter\CurlFactory::class
73-
)
74-
->disableOriginalConstructor()
75-
->getMock();
73+
$this->curlFactoryMock = $this->getMockBuilder(CurlFactory::class)
74+
->setMethods(['create'])
75+
->disableOriginalConstructor()
76+
->getMock();
7677
$this->curlFactoryMock->expects($this->any())
7778
->method('create')
7879
->willReturn($this->curlMock);

app/code/Magento/Analytics/Test/Unit/Model/CryptographerTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,20 @@ public function testEncodeNotValidCipherMethod()
207207

208208
$cryptographer->encode($source);
209209
}
210+
211+
/**
212+
* @expectedException \Magento\Framework\Exception\LocalizedException
213+
*/
214+
public function testEncodeTokenNotValid()
215+
{
216+
$source = 'Some string';
217+
218+
$this->analyticsTokenMock
219+
->expects($this->once())
220+
->method('getToken')
221+
->with()
222+
->willReturn(null);
223+
224+
$this->cryptographer->encode($source);
225+
}
210226
}

app/code/Magento/Analytics/Test/Unit/Model/EncodedContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testConstruct($content, $initializationVector)
4545
);
4646

4747
$this->assertSame($content, $encodedContext->getContent());
48-
$this->assertSame($initializationVector?:'', $encodedContext->getInitializationVector());
48+
$this->assertSame($initializationVector ?: '', $encodedContext->getInitializationVector());
4949
}
5050

5151
/**

app/code/Magento/Analytics/Test/Unit/Model/ExportDataHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected function setUp()
126126
}
127127

128128
/**
129-
* @param $isArchiveSourceDirectory
129+
* @param bool $isArchiveSourceDirectory
130130
* @dataProvider prepareExportDataDataProvider
131131
*/
132132
public function testPrepareExportData($isArchiveSourceDirectory)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Analytics\Test\Unit\ReportXml;
7+
8+
use Magento\Analytics\ReportXml\IteratorFactory;
9+
use Magento\Framework\ObjectManagerInterface;
10+
11+
/**
12+
* Class IteratorFactoryTest
13+
*/
14+
class IteratorFactoryTest extends \PHPUnit_Framework_TestCase
15+
{
16+
/**
17+
* @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
18+
*/
19+
private $objectManagerMock;
20+
/**
21+
* @var \IteratorIterator|\PHPUnit_Framework_MockObject_MockObject
22+
*/
23+
private $iteratorIteratorMock;
24+
25+
/**
26+
* @var IteratorFactory
27+
*/
28+
private $iteratorFactory;
29+
30+
/**
31+
* @return void
32+
*/
33+
protected function setUp()
34+
{
35+
$this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
36+
->disableOriginalConstructor()
37+
->getMock();
38+
39+
$this->iteratorIteratorMock = $this->getMockBuilder(\IteratorIterator::class)
40+
->disableOriginalConstructor()
41+
->getMock();
42+
43+
$this->iteratorFactory = new IteratorFactory(
44+
$this->objectManagerMock
45+
);
46+
}
47+
48+
public function testCreate()
49+
{
50+
$arrayObject = new \ArrayIterator([1, 2, 3, 4, 5]);
51+
$this->objectManagerMock->expects($this->once())
52+
->method('create')
53+
->with(\IteratorIterator::class, ['iterator' => $arrayObject])
54+
->willReturn($this->iteratorIteratorMock);
55+
56+
$this->assertEquals($this->iteratorFactory->create($arrayObject), $this->iteratorIteratorMock);
57+
}
58+
}

0 commit comments

Comments
 (0)