function it_normalizes_category_variations(Category $category, Category $parentCategory, CategoryTranslation $translation, $categoryMapping, $storeViewMapping, $categoryMappingManager)
 {
     $this->globalContext = array_merge($this->globalContext, ['magentoStoreViews' => [['code' => 'fr_fr']], 'magentoStoreView' => 'default']);
     $category->getParent()->willReturn($parentCategory);
     $category->getLabel()->willReturn('category_label');
     $category->setLocale('default_locale')->shouldBeCalled();
     $category->getTranslations()->willReturn([$translation]);
     $category->getCode()->willReturn('category_code');
     $translation->getLocale()->willReturn('fr_FR');
     $storeViewMapping->getTarget('fr_FR')->willReturn('fr_fr');
     $category->setLocale('fr_FR')->shouldBeCalled();
     $category->getLabel()->willReturn('Libélé de la catégorie');
     $categoryMappingManager->getIdFromCategory($category, 'soap_url')->willReturn(null);
     $categoryMappingManager->getIdFromCategory($parentCategory, 'soap_url', $categoryMapping)->willReturn(3);
     $categoryMapping->getTarget('category_code')->willReturn('category_code');
     $this->normalize($category, 'MagentoArray', $this->globalContext)->shouldReturn(['create' => [['magentoCategory' => ['3', ['name' => 'Libélé de la catégorie', 'is_active' => 1, 'include_in_menu' => 1, 'available_sort_by' => 1, 'default_sort_by' => 1], 'default'], 'pimCategory' => $category]], 'update' => [], 'move' => [], 'variation' => [['magentoCategory' => [null, ['name' => 'Libélé de la catégorie', 'available_sort_by' => 1, 'default_sort_by' => 1], 'fr_fr'], 'pimCategory' => $category]]]);
 }
 /**
  * Test getter/setter for label property
  */
 public function testGetSetLabel()
 {
     // Change value and assert new
     $newCode = 'code';
     $expectedCode = '[' . $newCode . ']';
     $this->category->setCode($newCode);
     $this->assertEquals($expectedCode, $this->category->getLabel());
     $newLabel = 'test-label';
     $this->assertEntity($this->category->setLocale('en_US'));
     $this->assertEntity($this->category->setLabel($newLabel));
     $this->assertEquals($newLabel, $this->category->getLabel());
     // if no translation, assert the expected code is returned
     $this->category->setLocale('fr_FR');
     $this->assertEquals($expectedCode, $this->category->getLabel());
     // if empty translation, assert the expected code is returned
     $this->category->setLabel('');
     $this->assertEquals($expectedCode, $this->category->getLabel());
 }
 /**
  * {@inheritDoc}
  */
 public function getLabel()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getLabel', array());
     return parent::getLabel();
 }
 function it_lists_and_format_categories($manager, Category $category0, Category $category1, Category $category2)
 {
     $manager->getProductsCountInCategory(Argument::any(), false)->willReturn(5);
     $category1->getId()->willReturn(2);
     $category1->getLabel()->willReturn('Some category 1');
     $category1->hasChildren()->willReturn(false);
     $category1->isRoot()->willReturn(false);
     $category1Array = ['item' => $category1, '__children' => []];
     $category2->getId()->willReturn(3);
     $category2->getLabel()->willReturn('Some category 2');
     $category2->hasChildren()->willReturn(false);
     $category2->isRoot()->willReturn(false);
     $category2Array = ['item' => $category2, '__children' => []];
     $category0->getId()->willReturn(1);
     $category0->getLabel()->willReturn('Parent category');
     $category0->hasChildren()->willReturn(true);
     $category0->isRoot()->willReturn(false);
     $category0Array = ['item' => $category0, '__children' => [$category1Array, $category2Array]];
     $expected = [['attr' => ['id' => 'node_1'], 'data' => 'Parent category', 'state' => 'open', 'children' => [['attr' => ['id' => 'node_2'], 'data' => 'Some category 1', 'state' => 'leaf', 'children' => [], 'selectedChildrenCount' => 0], ['attr' => ['id' => 'node_3'], 'data' => 'Some category 2', 'state' => 'leaf', 'children' => [], 'selectedChildrenCount' => 0]], 'selectedChildrenCount' => 0]];
     $this->listCategoriesResponse([$category0Array], new ArrayCollection())->shouldEqualUsingJSON($expected);
 }