You are here

public function ArrayPluginDefinitionDecoratorTest::testMergeDefaultDefinition in Plugin 8.2

@covers ::mergeDefaultDefinition @covers ::doMergeDefaultDefinition @covers ::validateMergeDefinition @covers ::isDefinitionCompatible

@depends testMergeDefaultArrayDefinition

File

tests/src/Unit/PluginDefinition/ArrayPluginDefinitionDecoratorTest.php, line 365

Class

ArrayPluginDefinitionDecoratorTest
@coversDefaultClass \Drupal\plugin\PluginDefinition\ArrayPluginDefinitionDecorator

Namespace

Drupal\Tests\plugin\Unit\PluginDefinition

Code

public function testMergeDefaultDefinition() {
  $other_definition = new ArrayPluginDefinitionDecorator();
  $other_definition['foo'] = $this
    ->randomMachineName();
  $other_definition['label'] = $this
    ->randomMachineName();
  $this
    ->assertSame($this->sut, $this->sut
    ->mergeDefaultDefinition($other_definition));
  $this
    ->assertSame($other_definition['foo'], $this->sut
    ->getArrayDefinition()['foo']);
  $this
    ->assertNotSame($other_definition['label'], $this->sut
    ->getArrayDefinition()['label']);
}