public function testAfterGetOptions() { $resultJson = '[]'; $this->jsonDecoder->expects($this->once())->method('decode')->with('[]')->willReturn([]); $expected = ['configurable_attribute_1' => [['mediaType' => 'type', 'videoUrl' => 'url', 'isBase' => true]]]; $this->jsonEncoder->expects($this->any())->method('encode')->with($expected)->willReturn(json_encode($expected)); $blockMock = $this->getMockBuilder('\\Magento\\ProductVideo\\Block\\Product\\View\\Gallery')->disableOriginalConstructor()->getMock(); $result = $this->plugin->afterGetOptionsMediaGalleryDataJson($blockMock, $resultJson); $this->assertEquals(json_encode($expected), $result); }