You are here

public function ContentHubEntityDependencyTest::testSetAuthor in Acquia Content Hub 8

Test setAuthor method.

@covers ::setAuthor

File

tests/src/Unit/ContentHubEntityDependencyTest.php, line 185

Class

ContentHubEntityDependencyTest
PHPUnit for the ContentHubEntityDependency class.

Namespace

Drupal\Tests\acquia_contenthub\Unit

Code

public function testSetAuthor() {
  $author = '00000000-9999-0000-0000-000000000000';
  $this->entity = $this
    ->createContentHubEntity();
  $ch_entity_dependency = new ContentHubEntityDependency($this->entity);
  $ch_entity_dependency
    ->setAuthor($author);
  $cdf = $ch_entity_dependency
    ->getRawEntity();
  $expected = [
    'type' => Attribute::TYPE_REFERENCE,
    'value' => [
      'en' => $author,
    ],
  ];
  $this
    ->assertEquals($expected, $cdf['attributes']['author']);
}