@@ -26,6 +26,11 @@ class HeadTest extends \PHPUnit_Framework_TestCase
26
26
*/
27
27
protected $ pageConfigMock ;
28
28
29
+ /**
30
+ * @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject
31
+ */
32
+ protected $ urlMock ;
33
+
29
34
/**
30
35
* @var \Magento\Framework\View\Page\Title|\PHPUnit_Framework_MockObject_MockObject
31
36
*/
@@ -39,12 +44,16 @@ protected function setUp()
39
44
$ this ->title = $ this ->getMockBuilder (\Magento \Framework \View \Page \Title::class)
40
45
->disableOriginalConstructor ()
41
46
->getMock ();
47
+ $ this ->urlMock = $ this ->getMockBuilder (\Magento \Framework \UrlInterface::class)
48
+ ->disableOriginalConstructor ()
49
+ ->getMock ();
42
50
43
51
$ objectManagerHelper = new ObjectManagerHelper ($ this );
44
52
$ this ->headGenerator = $ objectManagerHelper ->getObject (
45
53
\Magento \Framework \View \Page \Config \Generator \Head::class,
46
54
[
47
55
'pageConfig ' => $ this ->pageConfigMock ,
56
+ 'url ' => $ this ->urlMock ,
48
57
]
49
58
);
50
59
}
@@ -68,18 +77,27 @@ public function testProcess()
68
77
69
78
$ structureMock ->expects ($ this ->once ())->method ('processRemoveAssets ' );
70
79
$ structureMock ->expects ($ this ->once ())->method ('processRemoveElementAttributes ' );
80
+ $ this ->urlMock ->expects ($ this ->once ())
81
+ ->method ('getUrl ' )
82
+ ->with ('customcss/render/css ' )
83
+ ->willReturn ('http://magento.dev/customcss/render/css ' );
71
84
72
85
$ assets = [
73
- 'remoteCss ' => ['src ' => 'file-url ' , 'src_type ' => 'url ' , 'media ' => "all " , 'content_type ' => 'css ' ],
74
- 'remoteLink ' => ['src ' => 'file-url ' , 'src_type ' => 'url ' , 'media ' => "all " ],
86
+ 'remoteCss ' => ['src ' => 'file-url-css ' , 'src_type ' => 'url ' , 'media ' => "all " , 'content_type ' => 'css ' ],
87
+ 'remoteLink ' => ['src ' => 'file-url-link ' , 'src_type ' => 'url ' , 'media ' => "all " ],
88
+ 'controllerCss ' => ['src ' => 'customcss/render/css ' , 'src_type ' => 'controller ' , 'content_type ' => 'css ' , 'media ' => 'all ' ],
75
89
'name ' => ['src ' => 'file-path ' , 'ie_condition ' => 'lt IE 7 ' , 'media ' => "print " , 'content_type ' => 'css ' ],
76
90
];
91
+
77
92
$ this ->pageConfigMock ->expects ($ this ->at (0 ))
78
93
->method ('addRemotePageAsset ' )
79
- ->with ('remoteCss ' , 'css ' , ['attributes ' => ['media ' => 'all ' ]]);
94
+ ->with ('file-url-css ' , 'css ' , ['attributes ' => ['media ' => 'all ' ]]);
80
95
$ this ->pageConfigMock ->expects ($ this ->at (1 ))
81
96
->method ('addRemotePageAsset ' )
82
- ->with ('remoteLink ' , Head::VIRTUAL_CONTENT_TYPE_LINK , ['attributes ' => ['media ' => 'all ' ]]);
97
+ ->with ('file-url-link ' , Head::VIRTUAL_CONTENT_TYPE_LINK , ['attributes ' => ['media ' => 'all ' ]]);
98
+ $ this ->pageConfigMock ->expects ($ this ->at (2 ))
99
+ ->method ('addRemotePageAsset ' )
100
+ ->with ('http://magento.dev/customcss/render/css ' , 'css ' , ['attributes ' => ['media ' => 'all ' ]]);
83
101
$ this ->pageConfigMock ->expects ($ this ->once ())
84
102
->method ('addPageAsset ' )
85
103
->with ('name ' , ['attributes ' => ['media ' => 'print ' ], 'ie_condition ' => 'lt IE 7 ' ]);
0 commit comments