Пример #1
0
 public function __construct()
 {
     parent::__construct();
     parent::initializeDatabase();
     $this->itemholder = new ItemHolder(self::getLogger());
     $this->simpleRequiredData = new RequiredData();
     $this->simpleRequiredData->setShortDescription('short description')->setDescription('long description')->setTax(0)->setWeight(100);
     $this->configRequiredData = new RequiredData();
     $this->configRequiredData->setShortDescription('short description')->setDescription('long description');
     $config = new Configurable(clone $this->configRequiredData->setSku('config1')->setName('config1'), 'color');
     $category = new Category();
     $category->set('active-config');
     $category->set('inactive-config', false);
     $category->set('level01/level02/level03');
     $config->injectData($category);
     $config->addSimpleProduct(new Simple(clone $this->simpleRequiredData->setSku('configsimple-sku1')->setName('configsimple-sku1')->setQty(12)->setPrice(120)->set('special_price', 100)->set('color', 'blue')));
     $config->addSimpleProduct(new Simple(clone $this->simpleRequiredData->setSku('configsimple-sku2')->setName('configsimple-sku2')->setQty(24)->setPrice(110)->set('special_price', 80)->set('color', 'green')));
     $this->itemholder->addProduct($config);
     $this->itemholder->addProduct(new Simple(clone $this->simpleRequiredData->setSku('simple-sku1-dontmanagestock')->setQty(null)->setPrice(500)->setName('simple-sku1-dontmanagestock')));
     $this->itemholder->addProduct(new Simple(clone $this->simpleRequiredData->setSku('simple-sku2')->setQty(10)->setPrice(400)->setName('simple-sku2')));
     $this->itemholder->addProduct(new Simple(clone $this->simpleRequiredData->setSku('simple-sku3')->setQty(-10)->setPrice(300)->setName('simple-sku3')));
     $this->itemholder->addProduct(new Simple(clone $this->simpleRequiredData->setSku('simple-sku4')->setQty(0)->setPrice(200)->setName('simple-sku4')));
     $req = new RequiredData();
     $req->setType(RequiredData::TYPE_SIMPLE)->setSku('foobar');
     $this->itemholder->addProduct(new Imageproduct($req));
     $product1 = new Stock(new RequiredData());
     $product1->set('sku', 'stock-sku1')->set('qty', 10);
     $product2 = new Stock(new RequiredData());
     $product2->set('sku', 'stock-sku2')->set('qty', 30);
     $this->itemholder->addProduct($product1)->addProduct($product2);
     $this->itemsInserted = $this->itemholder->countProducts();
 }
Пример #2
0
 public function test_canAddCategoriesLevelsWithAnotherDemiliter()
 {
     $product = new Simple(clone $this->simpleRequiredData);
     $category = new Category();
     $category->set('level1*level2', true, true, true, '*');
     $product->injectData($category);
     $data = $product->getData();
     $this->assertEquals('level1/level2::1::1::1', $data['categories']);
 }