/** * @return ARSet */ public function getFileGroups() { ClassLoader::import('application.model.product.ProductFileGroup'); return ProductFileGroup::getProductGroups($this); }
public function testGetProductGroups() { // new product $product = Product::getNewInstance($this->rootCategory, 'test'); $product->save(); $groups = array(); foreach (range(1, 3) as $i) { $groups[$i] = ProductFileGroup::getNewInstance($product); $groups[$i]->position->set($i); $groups[$i]->setValueByLang('name', 'en', 'TEST_GROUP_' . $i); $groups[$i]->save(); } $this->assertEqual(count($groups), ProductFileGroup::getProductGroups($product)->getTotalRecordCount()); $i = 1; foreach (ProductFileGroup::getProductGroups($product) as $group) { $this->assertTrue($groups[$i] === $group); $i++; } }