Skip to content

Commit 5b22753

Browse files
author
Pavlo Cherniavskyi
committed
MAGETWO-33622: Junior+ Developer Workflow
- unit test
1 parent 060decb commit 5b22753

File tree

1 file changed

+48
-1
lines changed
  • dev/tests/unit/testsuite/Magento/Framework/View/Asset/PreProcessor

1 file changed

+48
-1
lines changed

dev/tests/unit/testsuite/Magento/Framework/View/Asset/PreProcessor/ChainTest.php

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
namespace Magento\Framework\View\Asset\PreProcessor;
88

9+
/**
10+
* Class ChainTest
11+
*
12+
* @package Magento\Framework\View\Asset\PreProcessor
13+
*/
914
class ChainTest extends \PHPUnit_Framework_TestCase
1015
{
1116
/**
@@ -83,4 +88,46 @@ public function isChangedDataProvider()
8388
['anotherContent', 'anotherType', true],
8489
];
8590
}
86-
}
91+
92+
public function testChainTargetAssetPathNonDevMode()
93+
{
94+
$assetPath = 'assetPath';
95+
$origPath = 'origPath';
96+
97+
$this->asset = $this->getMockForAbstractClass('\Magento\Framework\View\Asset\LocalInterface');
98+
$this->asset->expects($this->once())
99+
->method('getContentType')
100+
->will($this->returnValue('assetType'));
101+
$this->asset->expects($this->once())
102+
->method('getPath')
103+
->will($this->returnValue($assetPath));
104+
$this->object = new Chain($this->asset, 'origContent', 'origType', $origPath);
105+
106+
$this->assertSame($this->object->getTargetAssetPath(), $assetPath);
107+
$this->assertNotSame($this->object->getTargetAssetPath(), $origPath);
108+
}
109+
110+
public function testChainTargetAssetPathDevMode()
111+
{
112+
$assetPath = 'assetPath';
113+
$origPath = 'origPath';
114+
115+
$this->asset = $this->getMockForAbstractClass('\Magento\Framework\View\Asset\LocalInterface');
116+
$this->asset->expects($this->once())
117+
->method('getContentType')
118+
->will($this->returnValue('assetType'));
119+
$this->asset->expects($this->once())
120+
->method('getPath')
121+
->will($this->returnValue($assetPath));
122+
$this->object = new Chain(
123+
$this->asset,
124+
'origContent',
125+
'origType',
126+
$origPath,
127+
\Magento\Framework\App\State::MODE_DEVELOPER
128+
);
129+
130+
$this->assertSame($this->object->getTargetAssetPath(), $origPath);
131+
$this->assertNotSame($this->object->getTargetAssetPath(), $assetPath);
132+
}
133+
}

0 commit comments

Comments
 (0)