You are here

protected function S3FileTestTrait::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.

2 calls to S3FileTestTrait::assertCdfAttribute()
S3FileEntityHandlerTest::testOnParseCdf in modules/acquia_contenthub_s3/tests/src/Kernel/S3FileEntityHandlerTest.php
@covers ::onParseCdf
S3FileSchemeHandlerTest::testAddAttributes in modules/acquia_contenthub_s3/tests/src/Kernel/S3FileSchemeHandlerTest.php
@covers ::addAttributes

File

modules/acquia_contenthub_s3/tests/src/Kernel/S3FileTestTrait.php, line 86

Class

S3FileTestTrait
Provides common methods for s3 related tests.

Namespace

Drupal\Tests\acquia_contenthub_s3\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.');
}