@@ -22,6 +22,9 @@ public function testPrepareItemsByPageId()
22
22
$ urlBuilderMock = $ this ->getMockBuilder (\Magento \Framework \UrlInterface::class)
23
23
->disableOriginalConstructor ()
24
24
->getMock ();
25
+ $ scopeUrlBuilderMock = $ this ->getMockBuilder (\Magento \Cms \ViewModel \Page \Grid \UrlBuilder::class)
26
+ ->disableOriginalConstructor ()
27
+ ->getMock ();
25
28
$ contextMock = $ this ->getMockBuilder (\Magento \Framework \View \Element \UiComponent \ContextInterface::class)
26
29
->getMockForAbstractClass ();
27
30
$ processor = $ this ->getMockBuilder (\Magento \Framework \View \Element \UiComponent \Processor::class)
@@ -35,6 +38,7 @@ public function testPrepareItemsByPageId()
35
38
[
36
39
'urlBuilder ' => $ urlBuilderMock ,
37
40
'context ' => $ contextMock ,
41
+ 'scopeUrlBuilder ' => $ scopeUrlBuilderMock
38
42
]
39
43
);
40
44
@@ -46,12 +50,15 @@ public function testPrepareItemsByPageId()
46
50
47
51
// Define test input and expectations
48
52
$ title = 'page title ' ;
53
+ $ identifier = 'page_identifier ' ;
54
+
49
55
$ items = [
50
56
'data ' => [
51
57
'items ' => [
52
58
[
53
59
'page_id ' => $ pageId ,
54
- 'title ' => $ title
60
+ 'title ' => $ title ,
61
+ 'identifier ' => $ identifier
55
62
]
56
63
]
57
64
]
@@ -61,6 +68,7 @@ public function testPrepareItemsByPageId()
61
68
[
62
69
'page_id ' => $ pageId ,
63
70
'title ' => $ title ,
71
+ 'identifier ' => $ identifier ,
64
72
$ name => [
65
73
'edit ' => [
66
74
'href ' => 'test/url/edit ' ,
@@ -78,6 +86,12 @@ public function testPrepareItemsByPageId()
78
86
'post ' => true ,
79
87
'__disableTmpl ' => true ,
80
88
],
89
+ 'preview ' => [
90
+ 'href ' => 'test/url/view ' ,
91
+ 'label ' => __ ('View ' ),
92
+ '__disableTmpl ' => true ,
93
+ 'target ' => '_blank '
94
+ ]
81
95
],
82
96
],
83
97
];
@@ -107,6 +121,11 @@ public function testPrepareItemsByPageId()
107
121
],
108
122
]
109
123
);
124
+
125
+ $ scopeUrlBuilderMock ->expects ($ this ->any ())
126
+ ->method ('getUrl ' )
127
+ ->willReturn ('test/url/view ' );
128
+
110
129
$ model ->setName ($ name );
111
130
$ items = $ model ->prepareDataSource ($ items );
112
131
// Run test
0 commit comments