/** * @test * @dataProvider dataProvider * @loadFixture product.yaml */ public function testCollisionFromManualEntry($productData) { self::$setup->resetProductEntityStoreConfig('S99'); /* @var $existingProduct Mage_Catalog_Model_Product */ $existingProduct = Mage::getModel('catalog/product'); $existingProduct = $existingProduct->loadByAttribute('sku', 'S100'); $this->assertGreaterThan(0, $existingProduct->getId(), 'product with SKU S100 exists.'); // delete product with SKU S101 from previous tests $existingProduct = $existingProduct->loadByAttribute('sku', 'S101'); if ($existingProduct->getId()) { $existingProduct->delete(); } $newProduct = $this->_saveProduct($productData); $this->assertEquals('S101', $newProduct->getSku(), 'SKU of new product should skip over existing SKU'); }
/** * Always start with the first increment id as set up by install script */ public static function setUpBeforeClass() { self::$setup = Mage::getModel('sse_autosku/resource_setup', 'sse_autosku_setup'); self::$setup->resetProductEntityStoreConfig(); }