You are here

public function SchemaMetatagManagerTest::testEncodeJsonld in Schema.org Metatag 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/SchemaMetatagManagerTest.php \Drupal\Tests\schema_metatag\Unit\SchemaMetatagManagerTest::testEncodeJsonld()

@covers ::encodeJsonld

@dataProvider jsonData

File

tests/src/Unit/SchemaMetatagManagerTest.php, line 95

Class

SchemaMetatagManagerTest
@coversDefaultClass \Drupal\schema_metatag\SchemaMetatagManager

Namespace

Drupal\Tests\schema_metatag\Unit

Code

public function testEncodeJsonld($original, $desired) {
  $processed = SchemaMetatagManager::encodeJsonld($original);

  // Elmininate spacing and line breaks that don't matter.
  $processed = str_replace([
    "\n",
    '  ',
  ], "", $processed);
  $this
    ->assertEquals($desired, $processed);
}