You are here

protected function PrivateFileSchemeHandlerTest::assertCdfAttribute in Acquia Content Hub 8.2

Asserts CDF attribute values.

Parameters

\Acquia\ContentHubClient\CDF\CDFObject $cdf: The cdf under test.

string $attribute: The attribute to evaluate.

mixed $expected: The expected value of the attribute.

1 call to PrivateFileSchemeHandlerTest::assertCdfAttribute()
PrivateFileSchemeHandlerTest::testAddAttributes in tests/src/Kernel/PrivateFileSchemeHandlerTest.php
@covers ::addAttributes

File

tests/src/Kernel/PrivateFileSchemeHandlerTest.php, line 113

Class

PrivateFileSchemeHandlerTest
Tests the Private File Scheme Handler.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function assertCdfAttribute(CDFObject $cdf, string $attribute, $expected) : void {
  $attr = $cdf
    ->getAttribute($attribute);
  if (is_null($attr)) {
    Assert::fail("Attribute ({$attribute}) doesn't exist!");
  }
  Assert::assertEquals($cdf
    ->getAttribute($attribute)
    ->getValue()[LanguageInterface::LANGCODE_NOT_SPECIFIED], $expected, 'CDF attribute value and expected value do not match.');
}