/**
  * Test getter/setter for name property
  */
 public function testGetSetLabel()
 {
     // Change value and assert new
     $newCode = 'code';
     $expectedCode = '[' . $newCode . ']';
     $this->attribute->setCode($newCode);
     $this->assertEquals($expectedCode, $this->attribute->getLabel());
     $newLabel = 'test-label';
     $this->assertEntity($this->attribute->setLocale('en_US'));
     $this->assertEntity($this->attribute->setLabel($newLabel));
     $this->assertEquals($newLabel, $this->attribute->getLabel());
     // if no translation, assert the expected code is returned
     $this->attribute->setLocale('fr_FR');
     $this->assertEquals($expectedCode, $this->attribute->getLabel());
     // if empty translation, assert the expected code is returned
     $this->attribute->setLabel('');
     $this->assertEquals($expectedCode, $this->attribute->getLabel());
 }
 function it_provides_available_axis_as_a_sorted_choice($registry, AttributeRepository $attRepository, AbstractAttribute $attribute1, AbstractAttribute $attribute2)
 {
     $attribute1->getId()->willReturn(1);
     $attribute1->getLabel()->willReturn('Foo');
     $attribute2->getId()->willReturn(2);
     $attribute2->getLabel()->willReturn('Bar');
     $registry->getRepository(self::ATTRIBUTE_CLASS)->willReturn($attRepository);
     $attRepository->findAllAxis()->willReturn([$attribute1, $attribute2]);
     $this->getAvailableAxisChoices()->shouldReturn([2 => 'Bar', 1 => 'Foo']);
 }
 /**
  * Prepare attribute view
  *
  * @param AbstractAttribute     $attribute
  * @param ProductValueInterface $value
  * @param FormView              $view
  *
  * @return array
  */
 protected function prepareAttributeView(AbstractAttribute $attribute, ProductValueInterface $value, FormView $view)
 {
     $attributeView = array('id' => $attribute->getId(), 'isRemovable' => $value->isRemovable(), 'code' => $attribute->getCode(), 'label' => $attribute->getLabel(), 'sortOrder' => $attribute->getSortOrder(), 'allowValueCreation' => in_array($attribute->getAttributeType(), $this->choiceAttributeTypes), 'locale' => $value->getLocale());
     if ($attribute->isScopable()) {
         $attributeView['values'] = array_merge($this->getAttributeValues($attribute, $value->getLocale()), array($value->getScope() => $view));
         ksort($attributeView['values']);
     } else {
         $attributeView['value'] = $view;
     }
     $classes = $this->getAttributeClasses($attribute);
     if (!empty($classes)) {
         $attributeView['classes'] = $classes;
     }
     return $attributeView;
 }