You are here

public function AchVersionAttributeTest::testAchVersionCdfAttribute in Acquia Content Hub 8.2

Tests AchVersionAttribute event subscriber.

Tests covers that the attribute gets added or not. Checking the value would be problematic because of the different pipeline jobs.

Throws

\Exception

File

tests/src/Kernel/EventSubscriber/CdfAttributes/AchVersionAttributeTest.php, line 61

Class

AchVersionAttributeTest
Tests that ACH version attribute is added to client CDF.

Namespace

Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\CdfAttributes

Code

public function testAchVersionCdfAttribute() {
  $cdf = ClientCDFObject::create('uuid', [
    'settings' => [
      'name' => 'test',
    ],
  ]);
  $event = new BuildClientCdfEvent($cdf);
  $this->dispatcher
    ->dispatch(AcquiaContentHubEvents::BUILD_CLIENT_CDF, $event);
  $ach_attribute = $event
    ->getCdf()
    ->getAttribute('ch_version');
  $this
    ->assertNotNull($ach_attribute);
  $this
    ->assertEquals(CDFAttribute::TYPE_ARRAY_STRING, $ach_attribute
    ->getType());
}