public function AchVersionAttributeTest::testVersionFileMissing in Acquia Content Hub 8.2
Tests AchVersionAttribute event subscriber.
Tests covers that if version file is missing, it will throw exception.
Throws
\Exception
File
- tests/
src/ Kernel/ EventSubscriber/ CdfAttributes/ AchVersionAttributeTest.php, line 77
Class
- AchVersionAttributeTest
- Tests that ACH version attribute is added to client CDF.
Namespace
Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\CdfAttributesCode
public function testVersionFileMissing() {
$module_handler = $this
->prophesize(ModuleHandlerInterface::class);
$extension = $this
->prophesize(Extension::class);
$extension
->getPath()
->willReturn('');
$module_handler
->getModule(Argument::any())
->willReturn($extension
->reveal());
$pv_client = $this
->prophesize(ProjectVersionClient::class);
$cdf = ClientCDFObject::create('uuid', [
'settings' => [
'name' => 'test',
],
]);
$event = new BuildClientCdfEvent($cdf);
$ach_version_setter = new AchVersionAttribute($pv_client
->reveal(), $module_handler
->reveal());
$this
->expectException(\Exception::class);
$this
->expectExceptionMessage('ACH YAML version file doesn\'t exist.');
$ach_version_setter
->onBuildClientCdf($event);
}