public function testOgSiteName() { $metaData = new MetaData(); $this->assertTrue(is_array($metaData->get())); $this->assertTrue(empty($metaData->get())); $this->assertFalse($metaData->getOgSiteName()); $this->assertInstanceOf(BaseMetaData::class, $metaData->setOgSiteName('site-name')); $this->assertEquals(['site-name'], $metaData->getOgSiteName()); }
public function testComponentWithBaseGenerator() { $metaData = new MetaData(); $metaData->addTitle('First title'); $metaData->addTitle('Second title'); $metaData->setDescription('My description'); $metaData->addOgImage('og-image-1'); $metaData->addOgImage('og-image-2'); $generator = new BaseGenerator($metaData); $renderer = new DefaultRenderer(); $generator->addRenderer($renderer); $component = new MetaDataControl($metaData, $generator); ob_start(); $component->render(); $result = ob_get_contents(); ob_end_clean(); $this->assertEquals("<title>Second title | First title</title>\n<meta name=\"description\" content=\"My description\">\n<meta name=\"og:image\" content=\"og-image-1\">\n<meta name=\"og:image\" content=\"og-image-2\">", $result); }
public function testUnknownMethod() { $metaData = new MetaData(); $this->setExpectedExceptionRegExp(InvalidArgumentException::class, "/Method 'unknown' not found/"); $metaData->unknown('asdf'); }