PluginSettingsBaseTest.php

Same filename and directory in other branches
  1. 10 core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php
  2. 9 core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php
  3. 8.9.x core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php

Namespace

Drupal\Tests\Core\Field

File

core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Field;

use Drupal\Core\Field\PluginSettingsBase;
use Drupal\Tests\UnitTestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;

/**
 * Tests Drupal\Core\Field\PluginSettingsBase.
 */
class PluginSettingsBaseTest extends UnitTestCase {
  
  /**
   * Tests get third party settings.
   *
   * @legacy-covers ::getThirdPartySettings
   */
  public function testGetThirdPartySettings() : void {
    $plugin_settings = new TestPluginSettingsBase();
    $this->assertSame([], $plugin_settings->getThirdPartySettings());
    $this->assertSame([], $plugin_settings->getThirdPartySettings('test'));
    $plugin_settings->setThirdPartySetting('test', 'foo', 'bar');
    $this->assertSame([
      'foo' => 'bar',
    ], $plugin_settings->getThirdPartySettings('test'));
    $this->assertSame([], $plugin_settings->getThirdPartySettings('test2'));
  }

}

/**
 * Stub class for testing PluginSettingsBase.
 */
class TestPluginSettingsBase extends PluginSettingsBase {
  public function __construct() {
  }

}

Classes

Title Deprecated Summary
PluginSettingsBaseTest Tests Drupal\Core\Field\PluginSettingsBase.
TestPluginSettingsBase Stub class for testing PluginSettingsBase.

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