public function testGetWidgetOptions() { $rand = rand(); $this->mathRandom->expects($this->any())->method('getUniqueHash')->with('id_')->willReturn('id_' . $rand); $saveVideoUrl = 'http://host/index.php/admin/catalog/product_gallery/upload/key/'; $saveRemoteVideoUrl = 'http://host/index.php/admin/product_video/product_gallery/retrieveImage/'; $this->urlBuilder->expects($this->exactly(2))->method('getUrl')->willReturnOnConsecutiveCalls($saveVideoUrl, $saveRemoteVideoUrl); $value = ['saveVideoUrl' => $saveVideoUrl, 'saveRemoteVideoUrl' => $saveRemoteVideoUrl, 'htmlId' => 'id_' . $rand]; $this->jsonEncoderMock->expects($this->once())->method('encode')->with($value)->willReturn(json_encode($value)); $this->block->getWidgetOptions(); }