ConfigActionsTest.php

Same filename in this branch
  1. 11.x core/modules/media/tests/src/Kernel/ConfigActionsTest.php
  2. 11.x core/modules/language/tests/src/Kernel/ConfigActionsTest.php
  3. 11.x core/modules/field/tests/src/Kernel/ConfigActionsTest.php
  4. 11.x core/modules/contact/tests/src/Kernel/ConfigActionsTest.php
  5. 11.x core/modules/node/tests/src/Kernel/ConfigActionsTest.php
  6. 11.x core/modules/block/tests/src/Kernel/ConfigActionsTest.php

Namespace

Drupal\Tests\image\Kernel

File

core/modules/image/tests/src/Kernel/ConfigActionsTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\image\Kernel;

use Drupal\Core\Config\Action\ConfigActionManager;
use Drupal\image\Entity\ImageStyle;
use Drupal\KernelTests\KernelTestBase;

/**
 * @group image
 */
class ConfigActionsTest extends KernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'image',
        'system',
    ];
    private readonly ConfigActionManager $configActionManager;
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        $this->installConfig([
            'image',
            'system',
        ]);
        $this->configActionManager = $this->container
            ->get('plugin.manager.config_action');
    }
    public function testConfigActions() : void {
        $style = ImageStyle::load('large');
        $this->assertCount(2, $style->getEffects());
        $this->configActionManager
            ->applyAction('entity_method:image.style:addImageEffect', $style->getConfigDependencyName(), [
            'id' => 'image_desaturate',
            'weight' => 1,
        ]);
        $this->assertCount(3, ImageStyle::load('large')->getEffects());
    }

}

Classes

Title Deprecated Summary
ConfigActionsTest @group image

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.