5
5
*/
6
6
namespace Magento \Framework \View \Test \Unit \Asset \MergeStrategy ;
7
7
8
- use Magento \Framework \Filesystem \Directory \WriteInterface ;
9
- use \Magento \Framework \View \Asset \MergeStrategy \Direct ;
10
-
11
8
use Magento \Framework \App \Filesystem \DirectoryList ;
9
+ use Magento \Framework \Filesystem \Directory \WriteInterface ;
10
+ use Magento \Framework \View \Asset \MergeStrategy \Direct ;
12
11
12
+ /**
13
+ * Test for Magento\Framework\View\Asset\MergeStrategy\Direct.
14
+ */
13
15
class DirectTest extends \PHPUnit \Framework \TestCase
14
16
{
15
17
/**
@@ -69,7 +71,8 @@ public function testMergeNoAssets()
69
71
->method ('getUniqueHash ' )
70
72
->willReturn ($ uniqId );
71
73
$ this ->tmpDir ->expects ($ this ->once ())->method ('writeFile ' )->with ('foo/result ' . $ uniqId , '' );
72
- $ this ->tmpDir ->expects ($ this ->once ())->method ('renameFile ' )->with ('foo/result ' . $ uniqId , 'foo/result ' , $ this ->staticDir );
74
+ $ this ->tmpDir ->expects ($ this ->once ())->method ('renameFile ' )
75
+ ->with ('foo/result ' . $ uniqId , 'foo/result ' , $ this ->staticDir );
73
76
$ this ->object ->merge ([], $ this ->resultAsset );
74
77
}
75
78
@@ -83,7 +86,8 @@ public function testMergeGeneric()
83
86
->method ('getUniqueHash ' )
84
87
->willReturn ($ uniqId );
85
88
$ this ->tmpDir ->expects ($ this ->once ())->method ('writeFile ' )->with ('foo/result ' . $ uniqId , 'onetwo ' );
86
- $ this ->tmpDir ->expects ($ this ->once ())->method ('renameFile ' )->with ('foo/result ' . $ uniqId , 'foo/result ' , $ this ->staticDir );
89
+ $ this ->tmpDir ->expects ($ this ->once ())->method ('renameFile ' )
90
+ ->with ('foo/result ' . $ uniqId , 'foo/result ' , $ this ->staticDir );
87
91
$ this ->object ->merge ($ assets , $ this ->resultAsset );
88
92
}
89
93
@@ -92,7 +96,7 @@ public function testMergeCss()
92
96
$ uniqId = '_f929c374767e00712449660ea673f2f5 ' ;
93
97
$ this ->resultAsset ->expects ($ this ->exactly (3 ))
94
98
->method ('getPath ' )
95
- ->will ( $ this -> returnValue ( 'foo/result ' ) );
99
+ ->willReturn ( 'foo/result ' );
96
100
$ this ->resultAsset ->expects ($ this ->any ())->method ('getContentType ' )->will ($ this ->returnValue ('css ' ));
97
101
$ assets = $ this ->prepareAssetsToMerge (['one ' , 'two ' ]);
98
102
$ this ->cssUrlResolver ->expects ($ this ->exactly (2 ))
@@ -101,13 +105,14 @@ public function testMergeCss()
101
105
$ this ->cssUrlResolver ->expects ($ this ->once ())
102
106
->method ('aggregateImportDirectives ' )
103
107
->with ('12 ' )
104
- ->will ( $ this -> returnValue ( '1020 ' ) );
108
+ ->willReturn ( '1020 ' );
105
109
$ this ->mathRandomMock ->expects ($ this ->once ())
106
110
->method ('getUniqueHash ' )
107
111
->willReturn ($ uniqId );
108
112
$ this ->staticDir ->expects ($ this ->never ())->method ('writeFile ' );
109
113
$ this ->tmpDir ->expects ($ this ->once ())->method ('writeFile ' )->with ('foo/result ' . $ uniqId , '1020 ' );
110
- $ this ->tmpDir ->expects ($ this ->once ())->method ('renameFile ' )->with ('foo/result ' . $ uniqId , 'foo/result ' , $ this ->staticDir );
114
+ $ this ->tmpDir ->expects ($ this ->once ())->method ('renameFile ' )
115
+ ->with ('foo/result ' . $ uniqId , 'foo/result ' , $ this ->staticDir );
111
116
$ this ->object ->merge ($ assets , $ this ->resultAsset );
112
117
}
113
118
0 commit comments