Example #1
0
 public function testLoadSpecification()
 {
     ActiveRecord::removeFromPool($this->product);
     $this->product = Product::getInstanceByID($this->product->getID(), true);
     $this->product->loadSpecification();
     // save as soon as the specification is loaded to make sure all associated objects are marked as existing.
     // and won't be re-inserted in database
     try {
         $this->product->save();
         $this->pass();
     } catch (Exception $e) {
         $this->fail();
     }
     // set prices
     foreach ($this->product->getApplication()->getCurrencyArray() as $currency) {
         $this->product->setPrice($currency, 111);
     }
     $this->product->save();
     $arr = $this->product->toArray();
     foreach ($this->product->getApplication()->getCurrencyArray() as $currency) {
         $this->assertEqual($arr['price_' . $currency], 111);
     }
     // re-run all the previous tests on the restored object
     $this->testSimpleValues();
     $this->testSingleSelectValues();
     $this->testMultipleSelectValues();
     $arr = $this->product->toArray();
 }