You are here

protected function RulesIntegrationTestBase::getTypedData in Rules 8.3

Returns a typed data object.

This helper for quick creation of typed data objects.

Parameters

string $data_type: The data type to create an object for.

mixed $value: The value to set.

Return value

\Drupal\Core\TypedData\TypedDataInterface The created object.

8 calls to RulesIntegrationTestBase::getTypedData()
DataCalculateValueTest::testAdditionAction in tests/src/Unit/Integration/RulesAction/DataCalculateValueTest.php
Tests the addition of two numeric values.
DataCalculateValueTest::testDivisionAction in tests/src/Unit/Integration/RulesAction/DataCalculateValueTest.php
Tests the division of one numeric by another.
DataCalculateValueTest::testMaximumAction in tests/src/Unit/Integration/RulesAction/DataCalculateValueTest.php
Tests the use of max operator for 2 input values.
DataCalculateValueTest::testMinimumAction in tests/src/Unit/Integration/RulesAction/DataCalculateValueTest.php
Tests the use of min operator for 2 input values.
DataCalculateValueTest::testMultiplicationAction in tests/src/Unit/Integration/RulesAction/DataCalculateValueTest.php
Tests the multiplication of one numeric by another.

... See full list

File

tests/src/Unit/Integration/RulesIntegrationTestBase.php, line 329

Class

RulesIntegrationTestBase
Base class for Rules integration tests.

Namespace

Drupal\Tests\rules\Unit\Integration

Code

protected function getTypedData($data_type, $value) {
  $definition = $this->typedDataManager
    ->createDataDefinition($data_type);
  $data = $this->typedDataManager
    ->create($definition);
  $data
    ->setValue($value);
  return $data;
}