@@ -22,6 +22,9 @@ public function testPrepareItemsByPageId()
2222 $ urlBuilderMock = $ this ->getMockBuilder (\Magento \Framework \UrlInterface::class)
2323 ->disableOriginalConstructor ()
2424 ->getMock ();
25+ $ scopeUrlBuilderMock = $ this ->getMockBuilder (\Magento \Cms \ViewModel \Page \Grid \UrlBuilder::class)
26+ ->disableOriginalConstructor ()
27+ ->getMock ();
2528 $ contextMock = $ this ->getMockBuilder (\Magento \Framework \View \Element \UiComponent \ContextInterface::class)
2629 ->getMockForAbstractClass ();
2730 $ processor = $ this ->getMockBuilder (\Magento \Framework \View \Element \UiComponent \Processor::class)
@@ -35,6 +38,7 @@ public function testPrepareItemsByPageId()
3538 [
3639 'urlBuilder ' => $ urlBuilderMock ,
3740 'context ' => $ contextMock ,
41+ 'scopeUrlBuilder ' => $ scopeUrlBuilderMock
3842 ]
3943 );
4044
@@ -46,12 +50,15 @@ public function testPrepareItemsByPageId()
4650
4751 // Define test input and expectations
4852 $ title = 'page title ' ;
53+ $ identifier = 'page_identifier ' ;
54+
4955 $ items = [
5056 'data ' => [
5157 'items ' => [
5258 [
5359 'page_id ' => $ pageId ,
54- 'title ' => $ title
60+ 'title ' => $ title ,
61+ 'identifier ' => $ identifier
5562 ]
5663 ]
5764 ]
@@ -61,6 +68,7 @@ public function testPrepareItemsByPageId()
6168 [
6269 'page_id ' => $ pageId ,
6370 'title ' => $ title ,
71+ 'identifier ' => $ identifier ,
6472 $ name => [
6573 'edit ' => [
6674 'href ' => 'test/url/edit ' ,
@@ -78,6 +86,12 @@ public function testPrepareItemsByPageId()
7886 'post ' => true ,
7987 '__disableTmpl ' => true ,
8088 ],
89+ 'preview ' => [
90+ 'href ' => 'test/url/view ' ,
91+ 'label ' => __ ('View ' ),
92+ '__disableTmpl ' => true ,
93+ 'target ' => '_blank '
94+ ]
8195 ],
8296 ],
8397 ];
@@ -107,6 +121,11 @@ public function testPrepareItemsByPageId()
107121 ],
108122 ]
109123 );
124+
125+ $ scopeUrlBuilderMock ->expects ($ this ->any ())
126+ ->method ('getUrl ' )
127+ ->willReturn ('test/url/view ' );
128+
110129 $ model ->setName ($ name );
111130 $ items = $ model ->prepareDataSource ($ items );
112131 // Run test
0 commit comments