You are here

public function ConvertBooleanTest::testConvertBooleanNoMatchNull in Tamper 8

Test convert to boolean no match true case.

File

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

Class

ConvertBooleanTest
Tests the convert boolean plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

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