You are here

public function DefaultValueTest::testAnythingToDefaultValue in Tamper 8

Test anything changed to the value, even if value existed before.

File

tests/src/Unit/Plugin/Tamper/DefaultValueTest.php, line 30

Class

DefaultValueTest
Tests the default value plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function testAnythingToDefaultValue() {
  $config = [
    DefaultValue::SETTING_DEFAULT_VALUE => 'HEYO!',
    DefaultValue::SETTING_ONLY_IF_EMPTY => FALSE,
  ];
  $plugin = new DefaultValue($config, 'default_value', [], $this
    ->getMockSourceDefinition());
  $this
    ->assertEquals('HEYO!', $plugin
    ->tamper('asdfasdf'));
  $this
    ->assertEquals('HEYO!', $plugin
    ->tamper([
    'asdfasdf',
  ]));
  $this
    ->assertEquals('HEYO!', $plugin
    ->tamper([]));
}