CoreVersionAttributeTest.php in Acquia Content Hub 8.2
File
tests/src/Kernel/EventSubscriber/CdfAttributes/CoreVersionAttributeTest.php
View source
<?php
namespace Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\CdfAttributes;
use Acquia\ContentHubClient\CDF\ClientCDFObject;
use Acquia\ContentHubClient\CDFAttribute;
use Drupal\acquia_contenthub\AcquiaContentHubEvents;
use Drupal\acquia_contenthub\Event\BuildClientCdfEvent;
use Drupal\KernelTests\KernelTestBase;
class CoreVersionAttributeTest extends KernelTestBase {
public static $modules = [
'acquia_contenthub_server_test',
'acquia_contenthub',
'depcalc',
'user',
];
protected $dispatcher;
protected function setUp() {
parent::setUp();
$this->dispatcher = $this->container
->get('event_dispatcher');
}
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());
}
}