You are here

public function Drupal8Test::providerSetEntityProperty in Realistic Dummy Content 3.x

Provider for testSetEntityProperty().

File

api/tests/src/Unit/Framework/Drupal8Test.php, line 55

Class

Drupal8Test
Tests for \Drupal\realistic_dummy_content_api\Framework\Drupal8.

Namespace

Drupal\Tests\realistic_dummy_content_api\Unit\Framework

Code

public function providerSetEntityProperty() {

  // @codingStandardsIgnoreStart
  $class1 = new class {
    function set($param, $value) {
      $this->{$param} = $value;
    }

  };

  // @codingStandardsIgnoreEnd
  $class2 = $class1;
  $class2->whatever = "Hello World";
  return [
    [
      'message' => 'Base case',
      'entity' => $class1,
      'property' => 'whatever',
      'value' => 'Hello World',
      'expected' => $class2,
    ],
    [
      'message' => 'Value has "set" property',
      'entity' => $class1,
      'property' => 'whatever',
      'value' => [
        'set' => 'Hello World',
      ],
      'expected' => $class2,
    ],
  ];
}