diff --git a/docs/MetaHelper.md b/docs/MetaHelper.md index f9437f8..82d17a7 100644 --- a/docs/MetaHelper.md +++ b/docs/MetaHelper.md @@ -45,12 +45,12 @@ $this->set(compact('_meta'))); In your view ctp you can also do: ```php -$this->Meta->keywords('I, am, English', 'en'); -$this->Meta->keywords('Ich, bin, deutsch', 'de'); -$this->Meta->description('Foo Bar'); -$this->Meta->robots(['index' => false]); +$this->Meta->setKeywords('I, am, English', 'en'); +$this->Meta->setKeywords('Ich, bin, deutsch', 'de'); +$this->Meta->setDescription('Foo Bar'); +$this->Meta->setRobots(['index' => false]); ``` -By default this will not output anything, but collect it inside the helper. +All this data will be collected it inside the helper across teh whole request. Those calls can be best made in a view or element (because those are rendered before the layout). If you do it inside a layout make sure this happens before you call `out()`. @@ -63,11 +63,11 @@ echo $this->fetch('meta'); // This is a fallback (optional) for view blocks It will iterate over all defined meta tags and output them. Note that you can skip some of those, if you want using the `skip` option. -If you don't manually outputting them, you must define all tags prior to the `out()` call. +If you don't manually output them, you must define all tags prior to the `out()` call. The `out()` call should be the last PHP code in your `` section the layout HTML. You can also manually output each group of meta tags, e.g. all keywords and descriptions (which you defined before) in all languages using ```php -echo $this->Meta->keywords(); -echo $this->Meta->description(); +echo $this->Meta->getKeywords(); +echo $this->Meta->getDescription(); ``` diff --git a/docs/README.md b/docs/README.md index fe1352f..01cdeb4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,6 +9,6 @@ ## Contributing Your help is greatly appreciated. -Make sure tests pass: `php phpunit.phar` +Make sure tests pass: `composer test` -Make sure CS pass: `vendor/bin/sniff` and `vendor/bin/sniff -f` to auto-fix +Make sure CS pass: `composer cs-check` and `composer cs-fix` to auto-fix diff --git a/src/View/Helper/MetaHelper.php b/src/View/Helper/MetaHelper.php index 5b526d5..ccd386b 100644 --- a/src/View/Helper/MetaHelper.php +++ b/src/View/Helper/MetaHelper.php @@ -8,6 +8,7 @@ use Cake\View\Helper; use Cake\View\View; use Exception; +use RuntimeException; /** * @property \Cake\View\Helper\HtmlHelper $Html @@ -56,7 +57,7 @@ class MetaHelper extends Helper { * in that order (the latter trumps) * * @param \Cake\View\View $View - * @param array $options + * @param array $options */ public function __construct(View $View, array $options = []) { parent::__construct($View, $options); @@ -108,7 +109,7 @@ public function __construct(View $View, array $options = []) { * * @return string|null */ - protected function _guessLanguage() { + protected function _guessLanguage(): ?string { $locale = ini_get('intl.default_locale'); if (!$locale) { return null; @@ -122,14 +123,17 @@ protected function _guessLanguage() { } /** - * @param string|null $value - * @return string + * @param string $value + * @return void */ - public function title($value = null) { - if ($value !== null) { - $this->meta['title'] = $value; - } + public function setTitle(string $value): void { + $this->meta['title'] = $value; + } + /** + * @return string + */ + public function getTitle(): string { $value = $this->meta['title']; if ($value === false) { return ''; @@ -139,14 +143,17 @@ public function title($value = null) { } /** - * @param string|null $value - * @return string + * @param string $value + * @return void */ - public function charset($value = null) { - if ($value !== null) { - $this->meta['charset'] = $value; - } + public function setCharset(string $value): void { + $this->meta['charset'] = $value; + } + /** + * @return string + */ + public function getCharset(): string { $value = $this->meta['charset']; if ($value === false) { return ''; @@ -159,14 +166,17 @@ public function charset($value = null) { } /** - * @param string|null $value - * @return string + * @param string $value + * @return void */ - public function icon($value = null) { - if ($value !== null) { - $this->meta['icon'] = $value; - } + public function setIcon(string $value): void { + $this->meta['icon'] = $value; + } + /** + * @return string + */ + public function getIcon(): string { $value = $this->meta['icon']; if ($value === false) { return ''; @@ -182,30 +192,29 @@ public function icon($value = null) { * @param string $url * @param int $size * @param array $options - * @return string + * @return void */ - public function sizesIcon($url, $size, array $options = []) { - if ($url !== null) { - $options += [ - 'size' => $size, - 'prefix' => null, - ]; - $this->meta['sizesIcon'][$url] = $options; - } + public function setSizesIcon(string $url, int $size, array $options = []): void { + $options += [ + 'size' => $size, + 'prefix' => null, + ]; + $this->meta['sizesIcon'][$url] = $options; + } - /** @var array|bool $value */ + /** + * @param string $url + * + * @return string + */ + public function getSizesIcon(string $url): string { + /** @var array $value */ $value = $this->meta['sizesIcon'][$url]; - if ($value === false) { - return ''; - } - if ($value === true) { - $value = $options; - } $options = [ 'rel' => $value['prefix'] . 'icon', 'sizes' => $value['size'] . 'x' . $value['size'], - ] + $options; + ] + $value; $array = [ 'url' => $url, 'attrs' => $this->Html->templater()->formatAttributes($options, ['prefix', 'size']), @@ -215,50 +224,73 @@ public function sizesIcon($url, $size, array $options = []) { } /** - * Specify the target audience language of the page. - * Discouraged now. Instead use `lang` attribute for the html tag. - * - * @param string|null $value * @return string */ - public function language($value = null) { - if ($value !== null) { - $this->meta['language'] = $value; + public function getSizesIcons(): string { + /** @var array> $sizesIcons */ + $sizesIcons = $this->meta['sizesIcon'] ?? []; + + $icons = []; + foreach ($sizesIcons as $url => $options) { + $icons[] = $this->getSizesIcon($url); } - $language = $this->meta['language'] === true ? $this->_guessLanguage() : $this->meta['language']; + return implode(PHP_EOL, $icons); + } - if (!$language) { + /** + * @param string|null $value + * @return void + */ + public function setLanguage(string|null $value): void { + if ($value === null) { + $value = true; + } + + $this->meta['language'] = $value; + } + + /** + * @return string + */ + public function getLanguage(): string { + $value = $this->meta['language']; + if (!$value) { return ''; } + if ($value === true) { + $value = $this->_guessLanguage(); + } + $array = [ 'http-equiv' => 'language', - 'content' => $language, + 'content' => $value, ]; return (string)$this->Html->meta($array); } /** - * @param array|string|false|null $value - * @return string + * @param array|string|false $value + * @return void */ - public function robots($value = null) { - if ($value === false) { - return ''; - } - - if ($value !== null) { - $robots = $value; - if (is_array($value)) { - $defaults = $this->meta['robots']; - $robots += $defaults; - } - $this->meta['robots'] = $robots; + public function setRobots(array|string|false $value): void { + if (is_array($value)) { + $defaults = $this->meta['robots']; + $value += $defaults; } + $this->meta['robots'] = $value; + } + /** + * @return string + */ + public function getRobots(): string { $robots = $this->meta['robots']; + if ($robots === false) { + return ''; + } if (is_array($robots)) { foreach ($robots as $robot => $use) { @@ -271,22 +303,27 @@ public function robots($value = null) { } /** - * @param string|null $description + * @param string $value * @param string|null $lang - * @return string + * @return void */ - public function description($description = null, $lang = null) { - if ($description !== null) { - if ($lang && $this->meta['language'] && $lang !== $this->meta['language'] && !$this->getConfig('multiLanguage')) { - return ''; - } - - if ($lang === null) { - $lang = $this->meta['language'] ?: '*'; - } + public function setDescription(string $value, ?string $lang = null): void { + if ($lang && $this->meta['language'] && $lang !== $this->meta['language'] && !$this->getConfig('multiLanguage')) { + throw new RuntimeException('Not configured as multi-language'); + } - $this->meta['description'][$lang] = $description; + if ($lang === null) { + $lang = $this->meta['language'] ?: '*'; } + + $this->meta['description'][$lang] = $value; + } + + /** + * @param string|null $lang + * @return string + */ + public function getDescription(?string $lang = null): string { if (!is_array($this->meta['description'])) { if ($lang === null) { $lang = $this->meta['language'] ?: '*'; @@ -306,10 +343,16 @@ public function description($description = null, $lang = null) { continue; } } - $res[] = $this->description($content, $lang); + $array = [ + 'name' => 'description', + 'content' => $description, + 'lang' => $lang, + ]; + + $res[] = (string)$this->Html->meta($array); } - return implode('', $res); + return implode(PHP_EOL, $res); } $description = $this->meta['description'][$lang] ?? false; @@ -328,33 +371,35 @@ public function description($description = null, $lang = null) { } /** - * @param array|string|null $keywords + * @param array|string $value * @param string|null $lang - * @return string + * + * @return void */ - public function keywords($keywords = null, $lang = null) { - if ($keywords !== null) { - if ($lang && $this->meta['language'] && $lang !== $this->meta['language'] && !$this->getConfig('multiLanguage')) { - return ''; - } - - if ($lang === null) { - $lang = $this->meta['language'] ?: '*'; - } - - $keywords = (array)$keywords; - $this->meta['keywords'][$lang] = $keywords; + public function setKeywords(array|string $value, ?string $lang = null): void { + if ($lang && $this->meta['language'] && $lang !== $this->meta['language'] && !$this->getConfig('multiLanguage')) { + throw new RuntimeException('Not configured as multi-language'); } - if (!is_array($this->meta['keywords'])) { - if ($lang === null) { - $lang = $this->meta['language'] ?: '*'; - } - $this->meta['keywords'] = [$lang => $this->meta['keywords']]; + + if ($lang === null) { + $lang = $this->meta['language'] ?: '*'; } + $this->meta['keywords'][$lang] = $value; + } + + /** + * @param string|null $lang + * + * @return string + */ + public function getKeywords(?string $lang = null): string { if ($lang === null) { - /** @var array $keywords */ + /** @var array|string $keywords */ $keywords = $this->meta['keywords']; + if (!is_array($keywords)) { + return $this->keywords($keywords, $lang); + } $res = []; foreach ($keywords as $lang => $keyword) { @@ -364,6 +409,7 @@ public function keywords($keywords = null, $lang = null) { continue; } } + $res[] = $this->keywords($keyword, $lang); } @@ -372,6 +418,16 @@ public function keywords($keywords = null, $lang = null) { $keywords = $this->meta['keywords'][$lang] ?? false; + return $this->keywords($keywords, $lang); + } + + /** + * @param mixed $keywords + * @param string|null $lang + * + * @return string + */ + protected function keywords(mixed $keywords, ?string $lang): string { if ($keywords === false) { return ''; } @@ -395,7 +451,7 @@ public function keywords($keywords = null, $lang = null) { * @throws \Exception * @return string */ - public function custom($name = null, $value = null) { + public function custom($name = null, $value = null): string { if ($value !== null) { if ($name === null) { throw new Exception('Name must be provided'); @@ -427,19 +483,23 @@ public function custom($name = null, $value = null) { } /** - * Outputs a canonical tag to the page - * - * @param array|string|true|null $url Canonical URL override + * @param array|string|bool $value + * @return void + */ + public function setCanonical(array|string|bool $value): void { + $this->meta['canonical'] = $value; + } + + /** * @param bool $full * * @return string */ - public function canonical($url = null, $full = false) { - if ($url !== null) { - $this->meta['canonical'] = $url; - } - + public function getCanonical(bool $full = false): string { $url = $this->meta['canonical']; + if ($url === false) { + return ''; + } $options = [ 'fullBase' => $full, @@ -461,21 +521,20 @@ public function canonical($url = null, $full = false) { return $this->Html->templater()->format('css', $array); } + /** + * @param string $type + * @param string|false $value + * @return void + */ + public function setHttpEquiv(string $type, string|false $value): void { + $this->meta['http-equiv'][$type] = $value; + } + /** * @param string|null $type - * @param string|null $value - * @throws \Exception * @return string */ - public function httpEquiv($type = null, $value = null) { - if ($value !== null) { - if ($type === null) { - throw new Exception('Type must be provided'); - } - - $this->meta['http-equiv'][$type] = $value; - } - + public function getHttpEquiv(?string $type = null): string { if ($type === null) { $res = []; foreach ($this->meta['http-equiv'] as $type => $content) { @@ -490,6 +549,19 @@ public function httpEquiv($type = null, $value = null) { } $value = $this->meta['http-equiv'][$type]; + return $this->httpEquiv($type, $value); + } + + /** + * @param string $type + * @param string|false $value + * @return string + */ + protected function httpEquiv(string $type, string|false $value): string { + if ($value === false) { + return ''; + } + $array = [ 'http-equiv' => $type, 'content' => $value, @@ -515,10 +587,10 @@ public function httpEquiv($type = null, $value = null) { * - implode * * @param string|null $header Specific meta header to output - * @param array $options + * @param array $options * @return string */ - public function out($header = null, $options = []) { + public function out(?string $header = null, array $options = []): string { $defaults = [ 'implode' => '', 'skip' => [], @@ -535,35 +607,35 @@ public function out($header = null, $options = []) { } if ($header === 'charset') { - return $this->charset(); + return $this->getCharset(); } if ($header === 'icon') { - return $this->icon(); + return $this->getIcon(); } if ($header === 'title') { - return $this->title(); + return $this->getTitle(); } if ($header === 'canonical') { - return $this->canonical(); + return $this->getCanonical(); } if ($header === 'robots') { - return $this->robots(); + return $this->getRobots(); } if ($header === 'language') { - return $this->language(); + return $this->getLanguage(); } if ($header === 'keywords') { - return $this->keywords(); + return $this->getKeywords(); } if ($header === 'description') { - return $this->description(); + return $this->getDescription(); } if ($header === 'custom') { diff --git a/tests/TestCase/View/Helper/MetaHelperTest.php b/tests/TestCase/View/Helper/MetaHelperTest.php index 9cf7c27..f800c48 100644 --- a/tests/TestCase/View/Helper/MetaHelperTest.php +++ b/tests/TestCase/View/Helper/MetaHelperTest.php @@ -10,6 +10,7 @@ use Cake\TestSuite\TestCase; use Cake\View\View; use Meta\View\Helper\MetaHelper; +use RuntimeException; /** * MetaHelper tests @@ -57,23 +58,19 @@ public function setUp(): void { * @return void */ public function testMetaLanguage() { - $result = $this->Meta->language(); + $result = $this->Meta->getLanguage(); $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->language(true); + $this->Meta->setLanguage(null); + $result = $this->Meta->getLanguage(); $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->language(); - $this->assertEquals($expected, $result); - - $result = $this->Meta->language('deu'); + $this->Meta->setLanguage('deu'); + $result = $this->Meta->getLanguage(); $expected = ''; $this->assertEquals($expected, $result); - - $result = $this->Meta->language(); - $this->assertEquals($expected, $result); } /** @@ -84,15 +81,16 @@ public function testMetaLanguageConfiguration() { $this->Meta = new MetaHelper($this->View, ['language' => true]); - $result = $this->Meta->language(); + $result = $this->Meta->getLanguage(); $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->language('en'); + $this->Meta->setLanguage('en'); + $result = $this->Meta->getLanguage(); $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->language(); + $result = $this->Meta->getLanguage(); $this->assertEquals($expected, $result); } @@ -100,16 +98,19 @@ public function testMetaLanguageConfiguration() { * @return void */ public function testMetaRobots() { - $result = $this->Meta->robots(); + $result = $this->Meta->getRobots(); $this->assertEquals('', $result); - $result = $this->Meta->robots(['index' => true]); + $this->Meta->setRobots(['index' => true]); + $result = $this->Meta->getRobots(); $this->assertEquals('', $result); - $result = $this->Meta->robots('noindex,nofollow,archive'); + $this->Meta->setRobots('noindex,nofollow,archive'); + $result = $this->Meta->getRobots(); $this->assertEquals('', $result); - $result = $this->Meta->robots(false); + $this->Meta->setRobots(false); + $result = $this->Meta->getRobots(); $this->assertEquals('', $result); } @@ -121,10 +122,11 @@ public function testMetaRobotsConfiguration() { $options = ['robots' => ['follow' => true]]; $this->Meta = new MetaHelper($this->View, $options); - $result = $this->Meta->robots(); + $result = $this->Meta->getRobots(); $this->assertEquals('', $result); - $result = $this->Meta->robots(['index' => false]); + $this->Meta->setRobots(['index' => false]); + $result = $this->Meta->getRobots(); $this->assertEquals('', $result); } @@ -141,18 +143,19 @@ public function _testMetaName() { * @return void */ public function testMetaDescription() { - $result = $this->Meta->description('descr'); - $expected = ''; + $result = $this->Meta->getDescription(); + $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->description(); + $this->Meta->setDescription('descr'); + $result = $this->Meta->getDescription(); + $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->description('foo', 'deu'); - $expected = ''; - $this->assertEquals($expected, $result); + $this->Meta->setDescription('foo', 'deu'); - $result = $this->Meta->description(); + $result = $this->Meta->getDescription(); + $expected = ''; $this->assertEquals($expected, $result); } @@ -163,7 +166,7 @@ public function testMetaDescriptionString() { $this->View->set('_meta', ['description' => 'Foo Bar']); $this->Meta = new MetaHelper($this->View); - $result = $this->Meta->description(); + $result = $this->Meta->getDescription(); $expected = ''; $this->assertEquals($expected, $result); } @@ -174,41 +177,45 @@ public function testMetaDescriptionString() { * @return void */ public function testMetaKeywords() { - $result = $this->Meta->keywords('mystring'); + $this->Meta->setKeywords('mystring'); + $result = $this->Meta->getKeywords(); $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->keywords(['foo', 'bar']); + $this->Meta->setKeywords(['foo', 'bar']); + $result = $this->Meta->getKeywords(); $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->keywords(); + $result = $this->Meta->getKeywords(); $this->assertEquals($expected, $result); // Locale keywords trump global ones - $result = $this->Meta->keywords(['fooD', 'barD'], 'deu'); + $this->Meta->setKeywords(['fooD', 'barD'], 'deu'); + $result = $this->Meta->getKeywords('deu'); $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->keywords(); + $result = $this->Meta->getKeywords(); $this->assertEquals($expected, $result); // But you can force-get them - $result = $this->Meta->keywords(null, '*'); + $result = $this->Meta->getKeywords('*'); $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->keywords(['fooE', 'barE'], 'eng'); + $this->Meta->setKeywords(['fooE', 'barE'], 'eng'); + $result = $this->Meta->getKeywords('eng'); $expected = ''; $this->assertEquals($expected, $result); // Having multiple locale keywords combines them - $result = $this->Meta->keywords(); + $result = $this->Meta->getKeywords(); $expected = ''; $this->assertEquals($expected, $result); // Retrieve a specific one - $result = $this->Meta->keywords(null, 'eng'); + $result = $this->Meta->getKeywords('eng'); $expected = ''; $this->assertEquals($expected, $result); } @@ -220,7 +227,7 @@ public function testMetaKeywordsString() { $this->View->set('_meta', ['keywords' => 'Foo,Bar']); $this->Meta = new MetaHelper($this->View); - $result = $this->Meta->keywords(); + $result = $this->Meta->getKeywords(); $expected = ''; $this->assertEquals($expected, $result); } @@ -238,17 +245,17 @@ public function _testMetaRss() { * @return void */ public function testSizesIcon() { - $result = $this->Meta->sizesIcon('/favicon-32x32.png', 32); - $expected = ''; - $this->assertEquals($expected, $result); + $this->Meta->setSizesIcon('/favicon-16x16.png', 16); + $expected1 = ''; - $result = $this->Meta->sizesIcon('/favicon-32x32.png', 32, ['type' => 'image/png']); - $expected = ''; - $this->assertEquals($expected, $result); + $this->Meta->setSizesIcon('/favicon-32x32.png', 32, ['type' => 'image/png']); + $expected2 = ''; - $result = $this->Meta->sizesIcon('/apple-touch-icon-57x57.png', 57, ['prefix' => 'apple-touch-']); - $expected = ''; - $this->assertEquals($expected, $result); + $this->Meta->setSizesIcon('/apple-touch-icon-57x57.png', 57, ['prefix' => 'apple-touch-']); + $expected3 = ''; + + $result = $this->Meta->getSizesIcons(); + $this->assertEquals($expected1 . PHP_EOL . $expected2 . PHP_EOL . $expected3, $result); } /** @@ -257,20 +264,23 @@ public function testSizesIcon() { * @return void */ public function testMetaHttpEquiv() { - $result = $this->Meta->httpEquiv('expires', '0'); + $this->Meta->setHttpEquiv('expires', '0'); + $result = $this->Meta->getHttpEquiv(); $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->httpEquiv('foo', 'bar'); - $expected = ''; + $this->Meta->setHttpEquiv('foo', 'bar'); + $result = $this->Meta->getHttpEquiv(); + $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->httpEquiv('expires'); - $expected = ''; + $result = $this->Meta->getHttpEquiv(); + $expected = ''; $this->assertEquals($expected, $result); - $result = $this->Meta->httpEquiv(); - $expected = ''; + $this->Meta->setHttpEquiv('expires', false); + $result = $this->Meta->getHttpEquiv(); + $expected = ''; $this->assertEquals($expected, $result); } @@ -278,10 +288,12 @@ public function testMetaHttpEquiv() { * @return void */ public function testMetaCanonical() { - $is = $this->Meta->canonical('/some/url/param1'); + $this->Meta->setCanonical('/some/url/param1'); + $is = $this->Meta->getCanonical(); $this->assertEquals('', $is); - $is = $this->Meta->canonical(['plugin' => 'Meta', 'controller' => 'Foo', 'action' => 'bar'], true); + $this->Meta->setCanonical(['plugin' => 'Meta', 'controller' => 'Foo', 'action' => 'bar'], true); + $is = $this->Meta->getCanonical(); $this->assertEquals('', $is); } @@ -316,14 +328,15 @@ public function testOut() { $expected .= ''; $this->assertTextEquals($expected, $result); - $this->Meta->title('Foo'); - $this->Meta->canonical(true); - $this->Meta->language('de'); - $this->Meta->keywords('foo bar'); - $this->Meta->keywords('foo bar EN', 'en'); - $this->Meta->description('A sentence'); - $this->Meta->httpEquiv('expires', '0'); - $this->Meta->robots(['index' => true]); + $this->Meta->setCharset('utf-8'); + $this->Meta->setTitle('Foo'); + $this->Meta->setCanonical(true); + $this->Meta->setLanguage('de'); + $this->Meta->setKeywords('foo bar'); + $this->Meta->setKeywords('foo bar EN', 'en'); + $this->Meta->setDescription('A sentence'); + $this->Meta->setHttpEquiv('expires', '0'); + $this->Meta->setRobots(['index' => true]); $this->Meta->custom('viewport', 'width=device-width, initial-scale=1'); $this->Meta->custom('x', 'y'); @@ -348,38 +361,15 @@ public function testOut() { public function testOutMultiLanguageFalse() { $this->Meta->setConfig('multiLanguage', false); - $this->Meta->language('de'); - $this->Meta->keywords('foo bar'); - $this->Meta->keywords('foo bar EN', 'en'); - $this->Meta->description('A sentence', 'de'); - $this->Meta->description('A sentence EN', 'en'); + $this->Meta->setLanguage('de'); - $result = $this->Meta->out(null, ['implode' => PHP_EOL]); - - $expected = 'Controller Name - Action Name - - - - - -'; - $this->assertTextEquals($expected, $result); + $this->expectException(RuntimeException::class); - $this->Meta->language('en'); - $this->Meta->keywords('foo bar'); - $this->Meta->keywords('foo bar EN', 'en'); - $this->Meta->description('A sentence', 'de'); - $this->Meta->description('A sentence EN', 'en'); + $this->Meta->setKeywords('foo bar'); + $this->Meta->setKeywords('foo bar EN', 'en'); - $result = $this->Meta->out(null, ['implode' => PHP_EOL]); - $expected = 'Controller Name - Action Name - - - - - -'; - $this->assertTextEquals($expected, $result); + $this->Meta->setDescription('A sentence', 'de'); + $this->Meta->setDescription('A sentence EN', 'en'); } /**