You are here

public function SchemaMetatagManagerTest::testRecomputeSerializedLength 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::testRecomputeSerializedLength()

@covers ::recomputeSerializedLength

@dataProvider arrayData

File

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

Class

SchemaMetatagManagerTest
@coversDefaultClass \Drupal\schema_metatag\SchemaMetatagManager

Namespace

Drupal\Tests\schema_metatag\Unit

Code

public function testRecomputeSerializedLength($tests, $original, $original_serialized, $desired, $desired_serialized) {
  if (!in_array('recompute', $tests)) {
    $this
      ->assertTrue(TRUE);
    return;
  }
  $replaced = str_replace('Organization', 'ReallyBigOrganization', $original_serialized);
  $processed = SchemaMetatagManager::recomputeSerializedLength($replaced);
  $unserialized = unserialize($processed);
  $this
    ->assertIsArray($unserialized);
  $this
    ->assertContains('ReallyBigOrganization', $unserialized);
}