protected function MetatagFieldSerializerTest::prepareOutput in Acquia Content Hub 8.2
Prepare output for testMetatagSerializer.
Parameters
int $do_not_transform: Transform metatag canonical url.
string $rand_str: Random string.
Return value
array Array containing metatag values.
Throws
\Drupal\Core\Entity\EntityMalformedException
1 call to MetatagFieldSerializerTest::prepareOutput()
- MetatagFieldSerializerTest::testTransformMetatagValues in modules/
acquia_contenthub_metatag/ tests/ src/ Kernel/ EventSubscriber/ SerializeContentField/ MetatagFieldSerializerTest.php - Tests the serialization of the metatag field.
File
- modules/
acquia_contenthub_metatag/ tests/ src/ Kernel/ EventSubscriber/ SerializeContentField/ MetatagFieldSerializerTest.php, line 115
Class
- MetatagFieldSerializerTest
- Tests Metatag Field Serialization.
Namespace
Drupal\Tests\acquia_contenthub_metatag\Kernel\EventSubscriber\SerializeContentFieldCode
protected function prepareOutput(int $do_not_transform, string $rand_str) : array {
$this->configFactory
->getEditable('acquia_contenthub_metatag.settings')
->set('ach_metatag_node_url_do_not_transform', $do_not_transform)
->save();
$canonical_url = $do_not_transform ? '[node:url]' . $rand_str : $this->entity
->toUrl()
->setAbsolute()
->toString() . $rand_str;
return [
"title" => "[node:title] | [site:name]",
"description" => "[node:summary]",
"canonical_url" => $canonical_url,
];
}