public function MetatagManagerTest::testMetatagOrder in Metatag 8
Test the order of the meta tags as they are output.
File
- tests/
src/ Kernel/ MetatagManagerTest.php, line 80
Class
- MetatagManagerTest
- Test the Metatag Manager class.
Namespace
Drupal\Tests\metatag\KernelCode
public function testMetatagOrder() {
$tags = $this->metatagManager
->generateElements([
'og_image_width' => 100,
'og_image_height' => 100,
'og_image_url' => 'https://www.example.com/example/foo.png',
]);
$expected = [
'#attached' => [
'html_head' => [
[
[
'#tag' => 'meta',
'#attributes' => [
'property' => 'og:image:url',
'content' => 'https://www.example.com/example/foo.png',
],
],
'og_image_url_0',
],
[
[
'#tag' => 'meta',
'#attributes' => [
'property' => 'og:image:width',
'content' => 100,
],
],
'og_image_width',
],
[
[
'#tag' => 'meta',
'#attributes' => [
'property' => 'og:image:height',
'content' => 100,
],
],
'og_image_height',
],
],
],
];
$this
->assertEquals($expected, $tags);
}