/**
  * Test is/setter for useableAsGridFilter property
  *
  * TODO : Test with the both values
  */
 public function testIsSetUseableAsGridFilter()
 {
     $this->assertFalse($this->attribute->isUseableAsGridFilter());
     // change value and assert new
     $newUseableAsGridFilter = true;
     $this->assertEntity($this->attribute->setUseableAsGridFilter($newUseableAsGridFilter));
     $this->assertTrue($this->attribute->isUseableAsGridFilter());
 }
 /**
  * Ensure indexes from attribute if needed
  *
  * @param AbstractAttribute $attribute
  */
 public function ensureIndexesFromAttribute(AbstractAttribute $attribute)
 {
     if ($attribute->isUseableAsGridFilter() || AbstractProduct::IDENTIFIER_TYPE === $attribute->getAttributeType() || $attribute->isUnique()) {
         $this->indexCreator->ensureIndexesFromAttribute($attribute);
     }
 }
 function it_generates_attribute_indexes_when_saving_filterable_scopable_and_localizable_attribute($collection, $namingUtility, AbstractAttribute $description)
 {
     $description->getCode()->willReturn('description');
     $description->getBackendType()->willReturn('varchar');
     $description->isLocalizable()->willReturn(true);
     $description->isScopable()->willReturn(true);
     $description->isUseableAsGridFilter()->willReturn(true);
     $description->getAttributeType()->willReturn('pim_catalog_simpleselect');
     $namingUtility->getAttributeNormFields($description)->willReturn(['normalizedData.description-en_US-ecommerce', 'normalizedData.description-de_DE-ecommerce', 'normalizedData.description-en_US-mobile']);
     $this->ensureIndexesFromAttribute($description);
 }
 function it_removes_indexes_for_attribute_when_removing_it($indexPurger, AbstractAttribute $name, LifecycleEventArgs $args)
 {
     $name->isUseableAsGridFilter()->willReturn(true);
     $name->getAttributeType()->willReturn('pim_catalog_text');
     $name->isUnique()->willReturn(false);
     $args->getEntity()->willReturn($name);
     $indexPurger->purgeIndexesFromAttribute($name)->shouldBeCalled();
     $this->postRemove($args);
 }