function DataConvertTest::testInvalidRoundingBehavior
Test the behavior if rounding behavior is used with non integers.
@covers ::execute
File
-
tests/
src/ Unit/ Integration/ RulesAction/ DataConvertTest.php, line 119
Class
- DataConvertTest
- @coversDefaultClass \Drupal\rules\Plugin\RulesAction\DataConvert @group RulesAction
Namespace
Drupal\Tests\rules\Unit\Integration\RulesActionCode
public function testInvalidRoundingBehavior() {
// Set the expected exception class and message.
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('A rounding behavior only makes sense with an integer target type.');
$converted = $this->executeAction('some', 'decimal', 'down');
$this->assertIsFloat($converted->getValue());
$this->assertEquals('float', $converted->getDataDefinition()
->getDataType());
}