|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | +declare(strict_types=1); |
| 7 | + |
| 8 | +namespace Magento\Catalog\Model\Entity\Product\Attribute\Design\Options; |
| 9 | + |
| 10 | +use Magento\Framework\ObjectManagerInterface; |
| 11 | +use Magento\TestFramework\Helper\Bootstrap; |
| 12 | +use PHPUnit\Framework\TestCase; |
| 13 | + |
| 14 | +/** |
| 15 | + * Checks that product design options container return correct options. |
| 16 | + * |
| 17 | + * @see \Magento\Catalog\Model\Entity\Product\Attribute\Design\Options\Container |
| 18 | + */ |
| 19 | +class ContainerTest extends TestCase |
| 20 | +{ |
| 21 | + /** @var ObjectManagerInterface */ |
| 22 | + private $objectManager; |
| 23 | + |
| 24 | + /** @var Container */ |
| 25 | + private $container; |
| 26 | + |
| 27 | + /** |
| 28 | + * @inheritdoc |
| 29 | + */ |
| 30 | + protected function setUp(): void |
| 31 | + { |
| 32 | + parent::setUp(); |
| 33 | + |
| 34 | + $this->objectManager = Bootstrap::getObjectManager(); |
| 35 | + $this->container = $this->objectManager->get(Container::class); |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * @dataProvider getOptionTextDataProvider |
| 40 | + * @param string $value |
| 41 | + * @param array $expectedValue |
| 42 | + * @return void |
| 43 | + */ |
| 44 | + public function testGetOptionText(string $value, array $expectedValue): void |
| 45 | + { |
| 46 | + $actualValue = $this->container->getOptionText($value); |
| 47 | + $this->assertEquals($expectedValue[0], $actualValue); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * @return array |
| 52 | + */ |
| 53 | + public function getOptionTextDataProvider(): array |
| 54 | + { |
| 55 | + return [ |
| 56 | + 'with_value' => [ |
| 57 | + 'value' => 'container2', |
| 58 | + 'expected_value' => [__('Block after Info Column')], |
| 59 | + ], |
| 60 | + 'with_not_valid_value' => [ |
| 61 | + 'value' => 'container3', |
| 62 | + 'expected_value' => [false], |
| 63 | + ], |
| 64 | + ]; |
| 65 | + } |
| 66 | +} |
0 commit comments