You are here

public function CoreVersionAttributeTest::testCoreVersionCdfAttribute in Acquia Content Hub 8.2

Tests CoreVersionAttribute 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/CoreVersionAttributeTest.php, line 57

Class

CoreVersionAttributeTest
Tests that core version attribute is added to client CDF.

Namespace

Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\CdfAttributes

Code

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