@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | namespace Sylius\Behat\Context\Setup; |
| 13 | 13 | |
| 14 | 14 | use Behat\Behat\Context\Context; |
| 15 | -use Behat\Behat\Tester\Exception\PendingException; |
|
| 16 | 15 | use Behat\Gherkin\Node\TableNode; |
| 17 | 16 | use Behat\Mink\Element\NodeElement; |
| 18 | 17 | use Doctrine\Common\Persistence\ObjectManager; |
| 18 | +use Sylius\Behat\Service\SharedStorageInterface; |
|
| 19 | 19 | use Sylius\Component\Attribute\Factory\AttributeFactoryInterface; |
| 20 | 20 | use Sylius\Component\Core\Formatter\StringInflector; |
| 21 | 21 | use Sylius\Component\Core\Model\ChannelInterface; |
@@ -25,7 +25,6 @@ discard block |
||
| 25 | 25 | use Sylius\Component\Core\Model\ProductVariantInterface; |
| 26 | 26 | use Sylius\Component\Core\Pricing\Calculators; |
| 27 | 27 | use Sylius\Component\Core\Repository\ProductRepositoryInterface; |
| 28 | -use Sylius\Behat\Service\SharedStorageInterface; |
|
| 29 | 28 | use Sylius\Component\Core\Uploader\ImageUploaderInterface; |
| 30 | 29 | use Sylius\Component\Product\Factory\ProductFactoryInterface; |
| 31 | 30 | use Sylius\Component\Product\Generator\SlugGeneratorInterface; |
@@ -33,9 +32,9 @@ discard block |
||
| 33 | 32 | use Sylius\Component\Product\Model\ProductAttributeValueInterface; |
| 34 | 33 | use Sylius\Component\Product\Model\ProductOptionInterface; |
| 35 | 34 | use Sylius\Component\Product\Model\ProductOptionValueInterface; |
| 35 | +use Sylius\Component\Product\Resolver\ProductVariantResolverInterface; |
|
| 36 | 36 | use Sylius\Component\Resource\Factory\FactoryInterface; |
| 37 | 37 | use Sylius\Component\Taxation\Model\TaxCategoryInterface; |
| 38 | -use Sylius\Component\Product\Resolver\ProductVariantResolverInterface; |
|
| 39 | 38 | use Symfony\Component\HttpFoundation\File\UploadedFile; |
| 40 | 39 | |
| 41 | 40 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | $product = $this->createProduct($productName, $price); |
| 182 | 182 | |
| 183 | - $product->setDescription('Awesome '.$productName); |
|
| 183 | + $product->setDescription('Awesome ' . $productName); |
|
| 184 | 184 | |
| 185 | 185 | if ($this->sharedStorage->has('channel')) { |
| 186 | 186 | $product->addChannel($this->sharedStorage->get('channel')); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | { |
| 214 | 214 | $product = $this->createProduct($productName, $price); |
| 215 | 215 | |
| 216 | - $product->setDescription('Awesome '.$productName); |
|
| 216 | + $product->setDescription('Awesome ' . $productName); |
|
| 217 | 217 | |
| 218 | 218 | foreach ($channels as $channel) { |
| 219 | 219 | $product->addChannel($channel); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $product->setCode(StringInflector::nameToUppercaseCode($productName)); |
| 251 | 251 | $product->setSlug($this->slugGenerator->generate($productName)); |
| 252 | 252 | |
| 253 | - $product->setDescription('Awesome '.$productName); |
|
| 253 | + $product->setDescription('Awesome ' . $productName); |
|
| 254 | 254 | |
| 255 | 255 | if ($this->sharedStorage->has('channel')) { |
| 256 | 256 | $channel = $this->sharedStorage->get('channel'); |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | public function thisProductHasAttributeWithValue(ProductInterface $product, $productAttributeType, $productAttributeName, $value) |
| 357 | 357 | { |
| 358 | - $attribute = $this->createProductAttribute($productAttributeType,$productAttributeName); |
|
| 358 | + $attribute = $this->createProductAttribute($productAttributeType, $productAttributeName); |
|
| 359 | 359 | $attributeValue = $this->createProductAttributeValue($value, $attribute); |
| 360 | 360 | $product->addAttribute($attributeValue); |
| 361 | 361 | |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | public function thisProductHasPercentAttributeWithValue(ProductInterface $product, $productAttributeName, $value) |
| 369 | 369 | { |
| 370 | - $attribute = $this->createProductAttribute('percent',$productAttributeName); |
|
| 371 | - $attributeValue = $this->createProductAttributeValue($value/100, $attribute); |
|
| 370 | + $attribute = $this->createProductAttribute('percent', $productAttributeName); |
|
| 371 | + $attributeValue = $this->createProductAttributeValue($value / 100, $attribute); |
|
| 372 | 372 | $product->addAttribute($attributeValue); |
| 373 | 373 | |
| 374 | 374 | $this->objectManager->flush(); |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | |
| 552 | 552 | /** @var ImageInterface $productImage */ |
| 553 | 553 | $productImage = $this->productImageFactory->createNew(); |
| 554 | - $productImage->setFile(new UploadedFile($filesPath.$imagePath, basename($imagePath))); |
|
| 554 | + $productImage->setFile(new UploadedFile($filesPath . $imagePath, basename($imagePath))); |
|
| 555 | 555 | $productImage->setCode($imageCode); |
| 556 | 556 | $this->imageUploader->upload($productImage); |
| 557 | 557 | |