Example #1
1
 /**
  * @param ProductAttributeInterface $productAttribute
  *
  * @return mixed
  */
 private function getRandomValueForProductAttribute(ProductAttributeInterface $productAttribute)
 {
     switch ($productAttribute->getStorageType()) {
         case ProductAttributeValueInterface::STORAGE_BOOLEAN:
             return $this->faker->boolean;
         case ProductAttributeValueInterface::STORAGE_INTEGER:
             return $this->faker->numberBetween(0, 10000);
         case ProductAttributeValueInterface::STORAGE_FLOAT:
             return $this->faker->randomFloat(4, 0, 10000);
         case ProductAttributeValueInterface::STORAGE_TEXT:
             return $this->faker->sentence;
         case ProductAttributeValueInterface::STORAGE_DATE:
         case ProductAttributeValueInterface::STORAGE_DATETIME:
             return $this->faker->dateTimeThisCentury;
         default:
             throw new \BadMethodCallException();
     }
 }
 /**
  * @Then /^(this product attribute) should no longer exist in the registry$/
  */
 public function thisProductAttributeShouldNoLongerExistInTheRegistry(ProductAttributeInterface $productAttribute)
 {
     Assert::false($this->indexPage->isSingleResourceOnPage(['code' => $productAttribute->getCode()]), sprintf('Product attribute %s should no exist in the registry, but it does.', $productAttribute->getName()));
 }