You are here

public function DataConvertTest::testInvalidRoundingBehaviorException in Rules 8.3

Test the behavior if nonsense rounding_behaviors is set.

@covers ::execute

File

tests/src/Unit/Integration/RulesAction/DataConvertTest.php, line 134

Class

DataConvertTest
@coversDefaultClass \Drupal\rules\Plugin\RulesAction\DataConvert @group RulesAction

Namespace

Drupal\Tests\rules\Unit\Integration\RulesAction

Code

public function testInvalidRoundingBehaviorException() {

  // Set the expected exception class and message.
  $this
    ->expectException(InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('Unknown rounding behavior: invalid rounding');
  $value = 5.5;
  $rounding_behavior = 'invalid rounding';
  $this
    ->executeAction($value, 'integer', $rounding_behavior);
}