You are here

public function MathTest::testAdditionWithCasting in Tamper 8

Test addition with weird values cast to int.

File

tests/src/Unit/Plugin/Tamper/MathTest.php, line 39

Class

MathTest
Tests the math plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function testAdditionWithCasting() {
  $config = [
    Math::SETTING_OPERATION => 'addition',
    Math::SETTING_VALUE => 2,
  ];
  $plugin = new Math($config, 'math', [], $this
    ->getMockSourceDefinition());
  $this
    ->assertEquals(3, $plugin
    ->tamper(TRUE));
  $this
    ->assertEquals(2, $plugin
    ->tamper(FALSE));
  $this
    ->assertEquals(2, $plugin
    ->tamper(NULL));
}