public function testGetsAttributeValuesForEntitiesInCategory() { $category = CustomAttributeCategory::RESERVATION; $entityIds = array(1, 5, 10, 15, 20); $attributes = array(new TestCustomAttribute(1, 'label1'), new TestCustomAttribute(2, 'label2'), new TestCustomAttribute(3, 'label3', 1), new TestCustomAttribute(4, 'label4', 20), new TestCustomAttribute(5, 'label5', 99), new TestCustomAttribute(6, 'label6', 1)); $values = array(new AttributeEntityValue(1, 1, 'value1'), new AttributeEntityValue(2, 1, 'value2'), new AttributeEntityValue(3, 1, 'value3'), new AttributeEntityValue(4, 20, 'value20')); $this->attributeRepository->expects($this->once())->method('GetByCategory')->with($this->equalTo($category))->will($this->returnValue($attributes)); $this->attributeRepository->expects($this->once())->method('GetEntityValues')->with($this->equalTo($category), $this->equalTo($entityIds))->will($this->returnValue($values)); $attributeList = $this->attributeService->GetAttributes($category, $entityIds); $this->assertEquals(array(new Attribute($attributes[0], 'value1'), new Attribute($attributes[1], 'value2'), new Attribute($attributes[2], 'value3'), new Attribute($attributes[5], null)), $attributeList->GetAttributes(1)); $this->assertEquals(array(new Attribute($attributes[0], null), new Attribute($attributes[1], null), new Attribute($attributes[3], 'value20')), $attributeList->GetAttributes(20)); $this->assertEquals(array('label1', 'label2', 'label3', 'label4', 'label5', 'label6'), $attributeList->GetLabels()); }