![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/integration/testsuite/Magento/Cms/Command/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Cms\Command; use Magento\Cms\Model\Wysiwyg\Validator; use Magento\Framework\App\Config\ReinitableConfigInterface; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Tester\CommandTester; /** * Test the command. * * @magentoAppIsolation enabled * @magentoDbIsolation enabled */ class WysiwygRestrictCommandTest extends TestCase { /** * @var ReinitableConfigInterface */ private $config; /** * @var WysiwygRestrictCommandFactory */ private $factory; /** * @inheritDoc */ protected function setUp(): void { $objectManager = Bootstrap::getObjectManager(); $this->config = $objectManager->get(ReinitableConfigInterface::class); $this->factory = $objectManager->get(WysiwygRestrictCommandFactory::class); } /** * "Execute" method cases. * * @return array */ public function getExecuteCases(): array { return [ 'yes' => ['y', true], 'no' => ['n', false], 'no-but-different' => ['what', false] ]; } /** * Test the command. * * @param string $argument * @param bool $expectedFlag * @return void * @dataProvider getExecuteCases * @magentoConfigFixture default_store cms/wysiwyg/force_valid 0 */ public function testExecute(string $argument, bool $expectedFlag): void { /** @var WysiwygRestrictCommand $model */ $model = $this->factory->create(); $tester = new CommandTester($model); $tester->execute(['restrict' => $argument]); $this->config->reinit(); $this->assertEquals($expectedFlag, $this->config->isSetFlag(Validator::CONFIG_PATH_THROW_EXCEPTION)); } }