6
6
7
7
namespace Magento \Framework \View \Asset \PreProcessor ;
8
8
9
+ /**
10
+ * Class ChainTest
11
+ *
12
+ * @package Magento\Framework\View\Asset\PreProcessor
13
+ */
9
14
class ChainTest extends \PHPUnit_Framework_TestCase
10
15
{
11
16
/**
@@ -83,4 +88,46 @@ public function isChangedDataProvider()
83
88
['anotherContent ' , 'anotherType ' , true ],
84
89
];
85
90
}
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