function it_normalizes_translatable_object_using_activated_locales(TranslatableInterface $translatable, AttributeTranslation $english, AttributeTranslation $french) { $translatable->getTranslations()->willReturn([$english, $french]); $english->getLocale()->willReturn('en_US'); $english->getLabel()->willReturn('foo'); $french->getLocale()->willReturn('fr_FR'); $french->getLabel()->willReturn('bar'); $this->normalize($translatable, 'xml', ['locales' => ['en_US', 'de_DE', 'fr_FR', 'fr_BE']])->shouldReturn(['label' => ['en_US' => 'foo', 'de_DE' => '', 'fr_FR' => 'bar', 'fr_BE' => '']]); }
function it_throws_an_exception_if_method_not_exists(TranslatableInterface $translatable, AttributeTranslation $english, AttributeTranslation $french, AttributeTranslation $german) { $translatable->getTranslations()->willReturn([$english, $french, $german]); $english->getLocale()->willReturn('en_US'); $english->getLabel()->willReturn('foo'); $french->getLocale()->willReturn('fr_FR'); $french->getLabel()->willReturn('bar'); $german->getLocale()->willReturn('de_DE'); $german->getLabel()->willReturn('baz'); $this->shouldThrow('\\LogicException')->duringNormalize($translatable, 'csv', ['locales' => [], 'property' => 'unknown_property']); }
function it_normalizes_all_attribute_labels($attribute, $storeViewMapping, AttributeTranslation $translation) { $this->baseContext = array_merge($this->baseContext, ['magentoAttributes' => ['attribute_code_mapped' => ['type' => 'text']], 'magentoStoreViews' => [['store_id' => 1, 'code' => 'fr_fr'], ['store_id' => 2, 'code' => 'test']], 'create' => false]); $attribute->getAttributeType()->willReturn('pim_catalog_text'); $attribute->getCode()->willReturn('attribute_code'); $attribute->getTranslations()->willReturn([$translation]); $translation->getLocale()->willReturn('de_DE'); $translation->getLabel()->willReturn('Attribut kod !'); $storeViewMapping->getSource('fr_fr')->willReturn('fr_FR'); $storeViewMapping->getSource('test')->willReturn('de_DE'); $this->normalize($attribute, 'MagentoArray', $this->baseContext)->shouldReturn(['attribute_code_mapped', array_merge($this->baseNormalizedAttribute, ['frontend_label' => [['store_id' => 0, 'label' => 'attribute_code_mapped'], ['store_id' => 1, 'label' => 'attribute_code'], ['store_id' => 2, 'label' => 'Attribut kod !']]])]); }
/** * {@inheritDoc} */ public function getForeignKey() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getForeignKey', array()); return parent::getForeignKey(); }