@@ -91,9 +91,8 @@ public function testDrawGridToggle()
9191 * @dataProvider getAddSubIconTestValues
9292 * @param array $parameters
9393 * @param ProviderInterface|NULL
94- * @param string|NULL $expected
9594 */
96- public function testAddSubIcon (array $ parameters , $ provider, $ expected )
95+ public function testAddSubIcon (array $ parameters , $ provider )
9796 {
9897 $ GLOBALS ['BE_USER ' ] = $ this ->getMockBuilder (BackendUserAuthentication::class)->setMethods (array ('calcPerms ' ))->getMock ();
9998 $ GLOBALS ['BE_USER ' ]->expects ($ this ->any ())->method ('calcPerms ' );
@@ -118,13 +117,7 @@ public function testAddSubIcon(array $parameters, $provider, $expected)
118117 ObjectAccess::setProperty ($ provider , 'configurationService ' , $ configurationServiceMock , true );
119118 }
120119
121- $ result = $ instance ->addSubIcon ($ parameters , new PageLayoutView ());
122- if (null === $ expected ) {
123- $ this ->assertEmpty ($ result );
124- } else {
125- $ this ->assertNotNull ($ result );
126- }
127- unset($ GLOBALS ['TCA ' ]);
120+ $ instance ->addSubIcon ($ parameters , new PageLayoutView ());
128121 }
129122
130123 /**
@@ -134,18 +127,21 @@ public function getAddSubIconTestValues()
134127 {
135128 $ formWithoutIcon = Form::create ();
136129 $ formWithIcon = Form::create (array ('options ' => array ('icon ' => 'icon ' )));
137- $ providerWithoutForm = $ this ->getMockBuilder (Provider::class)->setMethods (array ('getForm ' ))->getMock ();
130+ $ providerWithoutForm = $ this ->getMockBuilder (Provider::class)->setMethods (array ('getForm ' , ' getGrid ' ))->getMock ();
138131 $ providerWithoutForm ->expects ($ this ->any ())->method ('getForm ' )->willReturn (null );
139- $ providerWithFormWithoutIcon = $ this ->getMockBuilder (Provider::class)->setMethods (array ('getForm ' ))->getMock ();
132+ $ providerWithoutForm ->expects ($ this ->any ())->method ('getGrid ' )->willReturn (Form \Container \Grid::create ());
133+ $ providerWithFormWithoutIcon = $ this ->getMockBuilder (Provider::class)->setMethods (array ('getForm ' , 'getGrid ' ))->getMock ();
140134 $ providerWithFormWithoutIcon ->expects ($ this ->any ())->method ('getForm ' )->willReturn ($ formWithoutIcon );
141- $ providerWithFormWithIcon = $ this ->getMockBuilder (Provider::class)->setMethods (array ('getForm ' ))->getMock ();
135+ $ providerWithFormWithoutIcon ->expects ($ this ->any ())->method ('getGrid ' )->willReturn (Form \Container \Grid::create ());
136+ $ providerWithFormWithIcon = $ this ->getMockBuilder (Provider::class)->setMethods (array ('getForm ' , 'getGrid ' ))->getMock ();
142137 $ providerWithFormWithIcon ->expects ($ this ->any ())->method ('getForm ' )->willReturn ($ formWithIcon );
138+ $ providerWithFormWithIcon ->expects ($ this ->any ())->method ('getGrid ' )->willReturn (Form \Container \Grid::create ());
143139 return array (
144- array (array ('tt_content ' , 1 , array ()), null , null ),
145- array (array ('tt_content ' , 1 , array ()), $ providerWithoutForm, null ),
146- array (array ('tt_content ' , 1 , array ('field ' => 'test ' )), $ providerWithoutForm, null ),
147- array (array ('tt_content ' , 1 , array ('field ' => 'test ' )), $ providerWithFormWithoutIcon, null ),
148- array (array ('tt_content ' , 1 , array ('field ' => 'test ' )), $ providerWithFormWithIcon, null ),
140+ ' no provider ' => array (array ('tt_content ' , 1 , array ()), null ),
141+ ' provider without form without field ' => array (array ('tt_content ' , 1 , array ()), $ providerWithoutForm ),
142+ ' provider without form with field ' => array (array ('tt_content ' , 1 , array ('field ' => 'test ' )), $ providerWithoutForm ),
143+ ' provider with form without icon ' => array (array ('tt_content ' , 1 , array ('field ' => 'test ' )), $ providerWithFormWithoutIcon ),
144+ ' provider with form with icon ' => array (array ('tt_content ' , 1 , array ('field ' => 'test ' )), $ providerWithFormWithIcon ),
149145 );
150146 }
151147}
0 commit comments