You are here

public function ConvertBooleanTest::testConvertBooleanNoMatchFalse in Tamper 8

Test convert to boolean no match false case.

File

tests/src/Unit/Plugin/Tamper/ConvertBooleanTest.php, line 44

Class

ConvertBooleanTest
Tests the convert boolean plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function testConvertBooleanNoMatchFalse() {
  $config = [
    ConvertBoolean::SETTING_TRUTH_VALUE => 'A',
    ConvertBoolean::SETTING_FALSE_VALUE => 'B',
    ConvertBoolean::SETTING_MATCH_CASE => FALSE,
    ConvertBoolean::SETTING_NO_MATCH => 'pass',
    ConvertBoolean::SETTING_OTHER_TEXT => '',
  ];
  $plugin = new ConvertBoolean($config, 'convert_boolean', [], $this
    ->getMockSourceDefinition());
  $this
    ->assertEquals(TRUE, $plugin
    ->tamper('A'));
  $this
    ->assertEquals(TRUE, $plugin
    ->tamper('a'));
  $this
    ->assertEquals(FALSE, $plugin
    ->tamper('B'));
  $this
    ->assertEquals(FALSE, $plugin
    ->tamper('b'));
  $this
    ->assertEquals('c', $plugin
    ->tamper('c'));
  $this
    ->assertEquals('C', $plugin
    ->tamper('C'));
}