/**
  * @return array
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function reverseTransformDataProvider()
 {
     // full attribute data
     $fullAttribute = $this->getFullAttribute();
     $fullInputAttribute = new Attribute();
     $fullInputAttribute->setType(Integer::NAME);
     // localized attribute data
     $localizedAttribute = new Attribute();
     $localizedAttribute->setCode('localized')->setType(Text::NAME)->setLocalized(true)->addLabel($this->createLabel(null, 'localized_label'))->addDefaultValue($this->createDefaultValue(null, null)->setText('localized_value'));
     $localizedInputAttribute = new Attribute();
     $localizedInputAttribute->setType(Text::NAME);
     // not localized attribute data
     $notLocalizedAttribute = new Attribute();
     $notLocalizedAttribute->setCode('not_localized')->setType(Text::NAME)->setLocalized(false)->addLabel($this->createLabel(null, 'not_localized_label'))->addDefaultValue($this->createDefaultValue(null, null)->setText('not_localized_value'));
     $notLocalizedInputAttribute = new Attribute();
     $notLocalizedInputAttribute->setType(Text::NAME);
     $fullView = $this->getFullView();
     // option attribute data
     $optionAttribute = $this->getOptionAttribute();
     $optionInputAttribute = new Attribute();
     $optionInputAttribute->setType(Select::NAME);
     $optionInputAttribute->resetOptions($optionAttribute->getOptions());
     $optionView = $this->getOptionView();
     return ['null' => ['view' => null, 'model' => null], 'full localized attribute' => ['view' => $fullView, 'model' => $fullAttribute, 'attribute' => $fullInputAttribute], 'normalize from not localized to localized' => ['view' => ['code' => 'localized', 'type' => Text::NAME, 'localized' => true, 'containHtml' => false, 'sharingType' => null, 'required' => false, 'unique' => false, 'validation' => null, 'label' => [null => 'localized_label'], 'defaultValue' => 'localized_value'], 'model' => $localizedAttribute, 'attribute' => $localizedInputAttribute], 'normalize from localized to not localized' => ['view' => ['code' => 'not_localized', 'type' => Text::NAME, 'localized' => false, 'containHtml' => false, 'sharingType' => null, 'required' => false, 'unique' => false, 'validation' => null, 'label' => [null => 'not_localized_label'], 'defaultValue' => [null => 'not_localized_value']], 'model' => $notLocalizedAttribute, 'attribute' => $notLocalizedInputAttribute], 'option attribute' => ['view' => $optionView, 'model' => $optionAttribute, 'attribute' => $optionInputAttribute]];
 }
Пример #2
0
 /**
  * @expectedException \LogicException
  * @expectedExceptionMessage Several attribute options found by the same option ID.
  */
 public function testGetOptionByIdException()
 {
     $firstOption = $this->createAttributeOption(1);
     $secondOption = $this->createAttributeOption(1);
     $attribute = new Attribute();
     $attribute->resetOptions([$firstOption, $secondOption]);
     $attribute->getOptionById(1);
 }