public function test_canAddGallery() { $product = new Simple(clone $this->simpleRequiredData); $image = new Images(); $image->addImageToGallery('gallery1.jpg', 'gallery1')->addImageToGallery('gallery2.jpg', 'gallery2')->addImageToGallery('gallery3.jpg', 'gallery3'); $product->injectData($image); $data = $product->getData(); $this->assertEquals('gallery1.jpg::gallery1;gallery2.jpg::gallery2;gallery3.jpg::gallery3', $data['gallery']); }
public function test_AddConfigurableProductToHolder() { $product = new Configurable($this->configRequiredData, 'color'); $simpleproduct1 = new Simple(clone $this->simpleRequiredData); $simpleproduct1->set('color', 'blue'); $product->addSimpleProduct($simpleproduct1); $simpleproduct2 = new Simple(clone $this->simpleRequiredData); $simpleproduct2->set('sku', 'sku2'); $simpleproduct2->set('color', 'green'); $product->addSimpleProduct($simpleproduct2); $productholder = new ItemHolder(self::getLogger()); $productholder->addProduct($simpleproduct1)->addProduct($simpleproduct2); }
public function test_canUnsetData() { $this->product->getRequiredData()->setStore('mystore'); $this->product->getRequiredData()->unsetKey('store'); $this->assertNull($this->product->getRequiredData()->getStore()); }
public function test_noCategoryAdded() { $product = new Simple(clone $this->simpleRequiredData); $category = new Category(); $product->injectData($category); $data = $product->getData(); $this->assertFalse(isset($data['categories'])); }
/** * Check to see if the added simple product has the keys to our configurable product * * @param Simple $product * * @return bool */ private function simpleProductConfigAttributeTest(Simple $product) { foreach ($this->getConfigurableAttribute() as $key) { if ($product->get($key) === null) { return false; } } return true; }