Skip to content

Commit 116d26d

Browse files
committed
Merge pull request #108 from magento-mpi/develop
[MPI] Sprint 58 contribution
2 parents d1a0d51 + bc47efb commit 116d26d

File tree

60 files changed

+1939
-353
lines changed

Some content is hidden

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

60 files changed

+1939
-353
lines changed

app/design/frontend/Magento/blank/Magento_RecurringPayment/web/css/source/_module.less

Lines changed: 0 additions & 40 deletions
This file was deleted.

app/design/frontend/Magento/luma/Magento_RecurringPayment/web/css/source/_module.less

Lines changed: 0 additions & 77 deletions
This file was deleted.

app/etc/di.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@
181181
<argument name="mode" xsi:type="init_parameter">Magento\Framework\App\State::PARAM_MODE</argument>
182182
</arguments>
183183
</type>
184+
<type name="Magento\Framework\View\Asset\Source">
185+
<arguments>
186+
<argument name="appMode" xsi:type="init_parameter">Magento\Framework\App\State::PARAM_MODE</argument>
187+
</arguments>
188+
</type>
189+
<type name="Magento\Framework\View\Page\Config\Renderer">
190+
<arguments>
191+
<argument name="appMode" xsi:type="init_parameter">Magento\Framework\App\State::PARAM_MODE</argument>
192+
</arguments>
193+
</type>
184194
<type name="Magento\Framework\App\Arguments\ValidationState">
185195
<arguments>
186196
<argument name="appMode" xsi:type="init_parameter">Magento\Framework\App\State::PARAM_MODE</argument>
@@ -535,11 +545,26 @@
535545
<argument name="stateCollection" xsi:type="object" shared="false">Magento\Framework\Mview\View\State\CollectionInterface</argument>
536546
</arguments>
537547
</type>
548+
<type name="Magento\Framework\App\View\Asset\Publisher" shared="false" />
538549
<type name="Magento\Framework\App\StaticResource">
539550
<arguments>
540551
<argument name="response" xsi:type="object" shared="false">Magento\Core\Model\File\Storage\Response</argument>
552+
<argument name="publisher" xsi:type="object">developerPublisher</argument>
541553
</arguments>
542554
</type>
555+
<virtualType name="developerPublisher" type="Magento\Framework\App\View\Asset\Publisher">
556+
<arguments>
557+
<argument name="materializationStrategyFactory" xsi:type="object">developerMaterialization</argument>
558+
</arguments>
559+
</virtualType>
560+
<virtualType name="developerMaterialization" type="Magento\Framework\App\View\Asset\MaterializationStrategy\Factory">
561+
<arguments>
562+
<argument name="strategiesList" xsi:type="array">
563+
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
564+
<item name="default" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>
565+
</argument>
566+
</arguments>
567+
</virtualType>
543568
<virtualType name="fallbackResolverSimpleWithGroupedCache" type="Magento\Framework\View\Design\FileResolution\Fallback\Resolver\Simple">
544569
<arguments>
545570
<argument name="cache" xsi:type="object">Magento\Framework\View\Design\FileResolution\Fallback\CacheData\Grouped</argument>

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,32 @@ function ($className) {
5656
)
5757
);
5858

59+
$sharedInstances = [
60+
'Magento\Framework\App\Cache\Type\Config' => $cache,
61+
'Magento\Framework\App\ObjectManager\ConfigLoader' => $configLoader,
62+
'Magento\Framework\App\ObjectManager\ConfigCache' => $configCache,
63+
'Magento\Framework\Config\ReaderInterface' => $this->getMock(
64+
'Magento\Framework\Config\ReaderInterface'
65+
),
66+
'Magento\Framework\Config\ScopeInterface' => $this->getMock('Magento\Framework\Config\ScopeInterface'),
67+
'Magento\Framework\Config\CacheInterface' => $this->getMock('Magento\Framework\Config\CacheInterface'),
68+
'Magento\Framework\Cache\FrontendInterface' =>
69+
$this->getMock('Magento\Framework\Cache\FrontendInterface'),
70+
'Magento\Framework\App\Resource' => $this->getMockBuilder('Magento\Framework\App\Resource')
71+
->disableOriginalConstructor()
72+
->getMock(),
73+
'Magento\Framework\App\Resource\Config' => $this->getMock(
74+
'Magento\Framework\App\Resource\Config',
75+
[],
76+
[],
77+
'',
78+
false
79+
)
80+
];
5981
$model = new \Magento\TestFramework\ObjectManager(
6082
$factory,
6183
$configMock,
62-
[
63-
'Magento\Framework\App\Cache\Type\Config' => $cache,
64-
'Magento\Framework\App\ObjectManager\ConfigLoader' => $configLoader,
65-
'Magento\Framework\App\ObjectManager\ConfigCache' => $configCache,
66-
'Magento\Framework\Config\ReaderInterface' => $this->getMock(
67-
'Magento\Framework\Config\ReaderInterface'
68-
),
69-
'Magento\Framework\Config\ScopeInterface' => $this->getMock('Magento\Framework\Config\ScopeInterface'),
70-
'Magento\Framework\Config\CacheInterface' => $this->getMock('Magento\Framework\Config\CacheInterface'),
71-
'Magento\Framework\Cache\FrontendInterface' =>
72-
$this->getMock('Magento\Framework\Cache\FrontendInterface'),
73-
'Magento\Framework\App\Resource' => $this->getMockBuilder('Magento\Framework\App\Resource')
74-
->disableOriginalConstructor()
75-
->getMock(),
76-
'Magento\Framework\App\Resource\Config' => $this->getMock(
77-
'Magento\Framework\App\Resource\Config',
78-
[],
79-
[],
80-
'',
81-
false
82-
)
83-
],
84+
$sharedInstances,
8485
$primaryLoaderMock
8586
);
8687

dev/tests/integration/testsuite/Magento/Framework/Interception/AbstractPlugin.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,20 @@ public function setUpInterceptionConfig($pluginConfig)
5252
$definitions
5353
);
5454
$interceptionDefinitions = new Definition\Runtime();
55+
$sharedInstances = [
56+
'Magento\Framework\Config\CacheInterface' => $cache,
57+
'Magento\Framework\Config\ScopeInterface' => $configScope,
58+
'Magento\Framework\Config\ReaderInterface' => $this->_configReader,
59+
'Magento\Framework\ObjectManager\RelationsInterface' => $relations,
60+
'Magento\Framework\ObjectManager\ConfigInterface' => $config,
61+
'Magento\Framework\Interception\ObjectManager\ConfigInterface' => $config,
62+
'Magento\Framework\ObjectManager\DefinitionInterface' => $definitions,
63+
'Magento\Framework\Interception\DefinitionInterface' => $interceptionDefinitions
64+
];
5565
$this->_objectManager = new \Magento\Framework\ObjectManager\ObjectManager(
5666
$factory,
5767
$config,
58-
[
59-
'Magento\Framework\Config\CacheInterface' => $cache,
60-
'Magento\Framework\Config\ScopeInterface' => $configScope,
61-
'Magento\Framework\Config\ReaderInterface' => $this->_configReader,
62-
'Magento\Framework\ObjectManager\RelationsInterface' => $relations,
63-
'Magento\Framework\ObjectManager\ConfigInterface' => $config,
64-
'Magento\Framework\Interception\ObjectManager\ConfigInterface' => $config,
65-
'Magento\Framework\ObjectManager\DefinitionInterface' => $definitions,
66-
'Magento\Framework\Interception\DefinitionInterface' => $interceptionDefinitions
67-
]
68+
$sharedInstances
6869
);
6970
$factory->setObjectManager($this->_objectManager);
7071
$config->setInterceptionConfig($interceptionConfig);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Framework\App\View\Asset\MaterializationStrategy;
8+
9+
class CopyTest extends \PHPUnit_Framework_TestCase
10+
{
11+
/**
12+
* @var Copy
13+
*/
14+
private $copyPublisher;
15+
16+
public function setUp()
17+
{
18+
$this->copyPublisher = new Copy;
19+
}
20+
21+
public function testPublishFile()
22+
{
23+
$rootDir = $this->getMockBuilder('Magento\Framework\Filesystem\Directory\WriteInterface')
24+
->getMock();
25+
$targetDir = $this->getMockBuilder('Magento\Framework\Filesystem\Directory\WriteInterface')
26+
->getMock();
27+
$sourcePath = 'source/path/file';
28+
$destinationPath = 'destination/path/file';
29+
30+
$rootDir->expects($this->once())
31+
->method('copyFile')
32+
->with(
33+
$sourcePath,
34+
$destinationPath,
35+
$targetDir
36+
)->willReturn(true);
37+
38+
$this->assertTrue($this->copyPublisher->publishFile($rootDir, $targetDir, $sourcePath, $destinationPath));
39+
}
40+
41+
public function testIsSupported()
42+
{
43+
$asset = $this->getMockBuilder('Magento\Framework\View\Asset\LocalInterface')
44+
->getMock();
45+
$this->assertTrue($this->copyPublisher->isSupported($asset));
46+
}
47+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Framework\App\View\Asset\MaterializationStrategy;
8+
9+
use Magento\Framework\ObjectManagerInterface;
10+
11+
class FactoryTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/**
14+
* @var ObjectManagerInterface | \PHPUnit_Framework_MockObject_MockObject
15+
*/
16+
private $objectManager;
17+
18+
public function setUp()
19+
{
20+
$this->objectManager = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface')
21+
->setMethods([])
22+
->getMock();
23+
}
24+
25+
public function testCreateEmptyStrategies()
26+
{
27+
$asset = $this->getAsset();
28+
$copyStrategy = $this->getMockBuilder('Magento\Framework\App\View\Asset\MaterializationStrategy\Copy')
29+
->setMethods([])
30+
->getMock();
31+
$copyStrategy->expects($this->once())
32+
->method('isSupported')
33+
->with($asset)
34+
->willReturn(true);
35+
36+
$this->objectManager->expects($this->once())
37+
->method('get')
38+
->with(Factory::DEFAULT_STRATEGY)
39+
->willReturn($copyStrategy);
40+
41+
$factory = new Factory($this->objectManager, []);
42+
$this->assertSame($copyStrategy, $factory->create($asset));
43+
}
44+
45+
public function testCreateSupported()
46+
{
47+
$asset = $this->getAsset();
48+
$copyStrategy = $this->getMockBuilder('Magento\Framework\App\View\Asset\MaterializationStrategy\Copy')
49+
->setMethods([])
50+
->getMock();
51+
$copyStrategy->expects($this->once())
52+
->method('isSupported')
53+
->with($asset)
54+
->willReturn(false);
55+
56+
$supportedStrategy = $this->getMockBuilder(
57+
'Magento\Framework\App\View\Asset\MaterializationStrategy\StrategyInterface'
58+
)
59+
->setMethods([])
60+
->getMock();
61+
$supportedStrategy->expects($this->once())
62+
->method('isSupported')
63+
->with($asset)
64+
->willReturn(true);
65+
66+
$factory = new Factory($this->objectManager, [$copyStrategy, $supportedStrategy]);
67+
$this->assertSame($supportedStrategy, $factory->create($asset));
68+
}
69+
70+
public function testCreateException()
71+
{
72+
$asset = $this->getAsset();
73+
$copyStrategy = $this->getMockBuilder('Magento\Framework\App\View\Asset\MaterializationStrategy\Copy')
74+
->setMethods([])
75+
->getMock();
76+
$copyStrategy->expects($this->once())
77+
->method('isSupported')
78+
->with($asset)
79+
->willReturn(false);
80+
81+
$this->objectManager->expects($this->once())
82+
->method('get')
83+
->with(Factory::DEFAULT_STRATEGY)
84+
->willReturn($copyStrategy);
85+
86+
$factory = new Factory($this->objectManager, []);
87+
88+
$this->setExpectedException('LogicException', 'No materialization strategy is supported');
89+
$factory->create($asset);
90+
}
91+
92+
/**
93+
* @return \Magento\Framework\View\Asset\LocalInterface | \PHPUnit_Framework_MockObject_MockObject
94+
*/
95+
private function getAsset()
96+
{
97+
return $this->getMockBuilder('Magento\Framework\View\Asset\LocalInterface')
98+
->setMethods([])
99+
->getMock();
100+
}
101+
}

0 commit comments

Comments
 (0)