X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fmetatag%2Ftests%2Fsrc%2FKernel%2FMetatagManagerTest.php;fp=web%2Fmodules%2Fcontrib%2Fmetatag%2Ftests%2Fsrc%2FKernel%2FMetatagManagerTest.php;h=f086bef4616d958e3f1d26bd02f83f47aea411a0;hp=4dcccdbb4ee4d863a81477265a49bf6494970c57;hb=059867c3f96750652c80f39e44c442a58c2549ee;hpb=f8fc16ae6b862bef59baaad5d051dd37b7ff11b2 diff --git a/web/modules/contrib/metatag/tests/src/Kernel/MetatagManagerTest.php b/web/modules/contrib/metatag/tests/src/Kernel/MetatagManagerTest.php index 4dcccdbb4..f086bef46 100644 --- a/web/modules/contrib/metatag/tests/src/Kernel/MetatagManagerTest.php +++ b/web/modules/contrib/metatag/tests/src/Kernel/MetatagManagerTest.php @@ -43,7 +43,69 @@ class MetatagManagerTest extends KernelTestBase { 'content' => 'http://www.example.com/example/foo.png', ], ], - 'og_image_url', + '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); + } + + /** + * Tests metatags with multiple values return multiple metatags. + */ + public function testMetatagMultiple() { + /** @var \Drupal\metatag\MetatagManager $metatag_manager */ + $metatag_manager = \Drupal::service('metatag.manager'); + + $tags = $metatag_manager->generateElements([ + 'og_image_width' => 100, + 'og_image_height' => 100, + 'og_image_url' => 'http://www.example.com/example/foo.png, http://www.example.com/example/foo2.png', + ]); + + $expected = [ + '#attached' => [ + 'html_head' => [ + [ + [ + '#tag' => 'meta', + '#attributes' => [ + 'property' => 'og:image:url', + 'content' => 'http://www.example.com/example/foo.png', + ], + ], + 'og_image_url_0', + ], + [ + [ + '#tag' => 'meta', + '#attributes' => [ + 'property' => 'og:image:url', + 'content' => 'http://www.example.com/example/foo2.png', + ], + ], + 'og_image_url_1', ], [ [