@@ -26,11 +26,18 @@ protected function setUp()
2626 )->disableOriginalConstructor ()->getMock ();
2727
2828 $ renders = [
29- 'default ' => ['type ' => '*/* ' , 'model ' => \Magento \Framework \Webapi \Rest \Response \Renderer \Json::class],
29+ 'application_xml ' => [
30+ 'type ' => 'application/xml ' ,
31+ 'model ' => \Magento \Framework \Webapi \Rest \Response \Renderer \Xml::class,
32+ ],
3033 'application_json ' => [
3134 'type ' => 'application/json ' ,
3235 'model ' => \Magento \Framework \Webapi \Rest \Response \Renderer \Json::class,
3336 ],
37+ 'default ' => [
38+ 'type ' => '*/* ' ,
39+ 'model ' => \Magento \Framework \Webapi \Rest \Response \Renderer \Json::class
40+ ],
3441 ];
3542
3643 $ this ->_factory = new \Magento \Framework \Webapi \Rest \Response \RendererFactory (
@@ -42,29 +49,43 @@ protected function setUp()
4249
4350 /**
4451 * Test GET method.
52+ *
53+ * @param array $acceptTypes
54+ * @param string $model
55+ * @dataProvider getTestDataProvider
4556 */
46- public function testGet ()
57+ public function testGet ($ acceptTypes , $ model )
4758 {
48- $ acceptTypes = ['application/json ' ];
49-
5059 /** Mock request getAcceptTypes method to return specified value. */
5160 $ this ->_requestMock ->expects ($ this ->once ())->method ('getAcceptTypes ' )->will ($ this ->returnValue ($ acceptTypes ));
5261 /** Mock renderer. */
53- $ rendererMock = $ this ->getMockBuilder (
54- \Magento \Framework \Webapi \Rest \Response \Renderer \Json::class
55- )->disableOriginalConstructor ()->getMock ();
62+ $ rendererMock = $ this ->getMockBuilder ($ model )->disableOriginalConstructor ()->getMock ();
5663 /** Mock object to return mocked renderer. */
5764 $ this ->_objectManagerMock ->expects (
5865 $ this ->once ()
5966 )->method (
6067 'get '
6168 )->with (
62- \ Magento \ Framework \ Webapi \ Rest \ Response \ Renderer \Json::class
69+ $ model
6370 )->will (
6471 $ this ->returnValue ($ rendererMock )
6572 );
6673 $ this ->_factory ->get ();
6774 }
75+
76+ /**
77+ * Data provider for method testGet
78+ *
79+ * @return array
80+ */
81+ public function getTestDataProvider ()
82+ {
83+ return [
84+ [['*/* ' ], \Magento \Framework \Webapi \Rest \Response \Renderer \Json::class],
85+ [['application/json ' ], \Magento \Framework \Webapi \Rest \Response \Renderer \Json::class],
86+ [['application/xml ' ], \Magento \Framework \Webapi \Rest \Response \Renderer \Xml::class],
87+ ];
88+ }
6889
6990 /**
7091 * Test GET method with wrong Accept HTTP Header.
0 commit comments