Exemplo n.º 1
0
 public function testGetList()
 {
     $productSku = 'downloadable_sku';
     $linkData = ['id' => 324, 'store_title' => 'rock melody', 'title' => 'just melody', 'price' => 23, 'number_of_downloads' => 3, 'sort_order' => 21, 'is_shareable' => 2, 'sample_type' => 'file', 'sample_url' => null, 'sample_file' => '/r/o/rock.melody.ogg', 'link_type' => 'url', 'link_url' => 'http://link.url', 'link_file' => null];
     $linkMock = $this->getMock('Magento\\Downloadable\\Model\\Link', ['getId', 'getStoreTitle', 'getTitle', 'getPrice', 'getNumberOfDownloads', 'getSortOrder', 'getIsShareable', 'getData', '__wakeup', 'setId'], [], '', false);
     $linkInterfaceMock = $this->getMock('\\Magento\\Downloadable\\Api\\Data\\LinkInterface');
     $this->repositoryMock->expects($this->once())->method('get')->with($productSku)->will($this->returnValue($this->productMock));
     $this->productTypeMock->expects($this->once())->method('getLinks')->with($this->productMock)->will($this->returnValue([$linkMock]));
     $this->setLinkAssertions($linkMock, $linkData);
     $this->linkFactoryMock->expects($this->once())->method('create')->willReturn($linkInterfaceMock);
     $this->assertEquals([$linkInterfaceMock], $this->service->getList($productSku));
 }