示例#1
0
 public function testGetChildren()
 {
     $productSku = 'productSku';
     $this->getOptions();
     $this->productRepository->expects($this->any())->method('get')->with($this->equalTo($productSku))->will($this->returnValue($this->product));
     $this->product->expects($this->once())->method('getTypeId')->will($this->returnValue('bundle'));
     $this->productType->expects($this->once())->method('setStoreFilter')->with($this->equalTo($this->storeId), $this->product);
     $this->productType->expects($this->once())->method('getSelectionsCollection')->with($this->equalTo($this->optionIds), $this->equalTo($this->product))->will($this->returnValue($this->selectionCollection));
     $this->productType->expects($this->once())->method('getOptionsIds')->with($this->equalTo($this->product))->will($this->returnValue($this->optionIds));
     $this->optionCollection->expects($this->once())->method('appendSelections')->with($this->equalTo($this->selectionCollection))->will($this->returnValue([$this->option]));
     $this->option->expects($this->any())->method('getSelections')->will($this->returnValue([$this->product]));
     $this->metadataConverter->expects($this->once())->method('createDataFromModel')->with($this->equalTo($this->product), $this->equalTo($this->product))->will($this->returnValue($this->metadata));
     $this->assertEquals([$this->metadata], $this->model->getChildren($productSku));
 }