|
| 1 | +<?php |
| 2 | +/************************************************************************ |
| 3 | + * |
| 4 | + * Copyright 2024 Adobe |
| 5 | + * All Rights Reserved. |
| 6 | + * |
| 7 | + * NOTICE: All information contained herein is, and remains |
| 8 | + * the property of Adobe and its suppliers, if any. The intellectual |
| 9 | + * and technical concepts contained herein are proprietary to Adobe |
| 10 | + * and its suppliers and are protected by all applicable intellectual |
| 11 | + * property laws, including trade secret and copyright laws. |
| 12 | + * Dissemination of this information or reproduction of this material |
| 13 | + * is strictly forbidden unless prior written permission is obtained |
| 14 | + * from Adobe. |
| 15 | + * ************************************************************************ |
| 16 | + */ |
| 17 | +declare(strict_types=1); |
| 18 | + |
| 19 | +namespace Magento\Ui\Component\Listing\Column\Store; |
| 20 | + |
| 21 | +use Magento\Framework\Exception\LocalizedException; |
| 22 | +use Magento\Store\Test\Fixture\Store as StoreFixture; |
| 23 | +use Magento\Store\Ui\Component\Listing\Column\Store\Options; |
| 24 | +use Magento\TestFramework\Fixture\DataFixture; |
| 25 | +use Magento\TestFramework\Fixture\DataFixtureStorage; |
| 26 | +use Magento\TestFramework\Fixture\DataFixtureStorageManager; |
| 27 | +use Magento\TestFramework\Helper\Bootstrap; |
| 28 | +use PHPUnit\Framework\TestCase; |
| 29 | + |
| 30 | +class OptionsTest extends TestCase |
| 31 | +{ |
| 32 | + /** |
| 33 | + * @var DataFixtureStorage |
| 34 | + */ |
| 35 | + private $fixtures; |
| 36 | + |
| 37 | + /** |
| 38 | + * @var Options |
| 39 | + */ |
| 40 | + private $storesList; |
| 41 | + |
| 42 | + /** |
| 43 | + * @throws LocalizedException |
| 44 | + */ |
| 45 | + protected function setUp(): void |
| 46 | + { |
| 47 | + $objectManager = Bootstrap::getObjectManager(); |
| 48 | + $this->fixtures = DataFixtureStorageManager::getStorage(); |
| 49 | + $this->storesList = $objectManager->get(Options::class); |
| 50 | + } |
| 51 | + |
| 52 | + #[ |
| 53 | + DataFixture(StoreFixture::class, ["name" =>"Default's Store"], 'store'), |
| 54 | + ] |
| 55 | + public function testStoreLabeleWithSingleQuote() |
| 56 | + { |
| 57 | + $storeName = $this->fixtures->get('store')->getName(); |
| 58 | + $storeStructure = $this->storesList->toOptionArray(); |
| 59 | + self::assertNotEmpty($storeStructure); |
| 60 | + $storeGroups = $storeStructure[0]['value']; |
| 61 | + foreach ($storeGroups as $storeGroup) { |
| 62 | + $storeViews = $storeGroup['value']; |
| 63 | + $storeLabels = array_column($storeViews, 'label'); |
| 64 | + $expectedLabel = str_repeat(' ', 8) . $storeName; |
| 65 | + self::assertContainsEquals($expectedLabel, $storeLabels); |
| 66 | + } |
| 67 | + } |
| 68 | +} |
0 commit comments