public function process() { static $beenHere = null; if (!$beenHere) { Product::defineSchema(); $schema = Product::getSchemaInstance('Product'); $schema->registerField(new ArField('custom', ARText::instance())); } $beenHere = true; }
public function testTextRules() { $schema = Product::getSchemaInstance('Product'); $schema->registerField(new ArField('custom', ARText::instance())); $product = Product::getNewInstance($this->categories['1.2.1']); $product->sku->set('testing'); $product->custom->set('something else'); $product->setValueByLang('name', null, 'product name'); $product->save(); $rule = ClonedStoreRule::getNewInstance($this->stores[0], ClonedStoreRule::TYPE_TEXT); $rule->field->set('Product.sku'); $rule->find->set('sti'); $rule->repl->set('blah'); $rule->save(); $rule = ClonedStoreRule::getNewInstance($this->stores[0], ClonedStoreRule::TYPE_TEXT); $rule->field->set('Product.name'); $rule->find->set('ct'); $rule->repl->set('kta'); $rule->save(); $rule = ClonedStoreRule::getNewInstance($this->stores[0], ClonedStoreRule::TYPE_TEXT); $rule->field->set('Product.custom'); $rule->find->set('thing'); $rule->repl->set('nothing'); $rule->save(); $updater = $this->getUpdater(); $updater->syncAll(); $row = ActiveRecord::getDataBySQL('SELECT * FROM ' . $updater->getImportDatabase() . '.Product WHERE ID=' . $product->getID()); $row = array_shift($row); $this->assertEqual($row['sku'], 'teblahng'); $this->assertEqual($row['custom'], 'somenothing else'); $name = unserialize($row['name']); $this->assertEqual($name[$this->getApplication()->getDefaultLanguageCode()], 'produkta name'); }