/** * @param array|null $sortWeights * @param float $expected * @dataProvider getSortWeightDataProvider */ public function testGetSortWeight($sortWeights, $expected) { $setId = 123; $this->_model->setAttributeSetInfo(array($setId => $sortWeights)); $this->assertEquals($expected, $this->_model->getSortWeight($setId)); }
/** * Compare attributes * * @param Mage_Eav_Model_Entity_Attribute $attribute1 * @param Mage_Eav_Model_Entity_Attribute $attribute2 * @return int */ public function attributesCompare($attribute1, $attribute2) { $sort1 = $attribute1->getSortWeight((int) $this->_sortingSetId); $sort2 = $attribute2->getSortWeight((int) $this->_sortingSetId); if ($sort1 > $sort2) { return 1; } elseif ($sort1 < $sort2) { return -1; } return 0; }