mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge branch 'pr-2105' into 4.0
This commit is contained in:
commit
84db517bfe
@ -299,7 +299,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
* @config
|
||||
* @var string
|
||||
*/
|
||||
private static $meta_generator = 'SilverStripe - http://silverstripe.org';
|
||||
private static $meta_generator = 'SilverStripe - https://www.silverstripe.org';
|
||||
|
||||
protected $_cache_statusFlags = null;
|
||||
|
||||
|
@ -1227,35 +1227,36 @@ class SiteTreeTest extends SapphireTest
|
||||
{
|
||||
$generator = Config::inst()->get(SiteTree::class, 'meta_generator');
|
||||
|
||||
// Stub to ensure customisations don't affect the test
|
||||
Config::modify()->set(SiteTree::class, 'meta_generator', 'SilverStripe - https://www.silverstripe.org');
|
||||
|
||||
$page = new SiteTreeTest_PageNode();
|
||||
|
||||
$meta = $page->MetaTags();
|
||||
$this->assertEquals(
|
||||
1,
|
||||
preg_match('/.*meta name="generator" content="SilverStripe - http:\/\/silverstripe.org".*/', $meta),
|
||||
'test default functionality - uses value from Config'
|
||||
$this->assertContains('meta name="generator"', $meta, 'Should include generator tag');
|
||||
$this->assertContains(
|
||||
'content="SilverStripe - https://www.silverstripe.org',
|
||||
$meta,
|
||||
'Should contain default meta generator info'
|
||||
);
|
||||
|
||||
// test proper escaping of quotes in attribute value
|
||||
Config::modify()->set(SiteTree::class, 'meta_generator', 'Generator with "quotes" in it');
|
||||
$meta = $page->MetaTags();
|
||||
$this->assertEquals(
|
||||
1,
|
||||
preg_match('/.*meta name="generator" content="Generator with "quotes" in it".*/', $meta),
|
||||
$this->assertContains(
|
||||
'content="Generator with "quotes" in it',
|
||||
$meta,
|
||||
'test proper escaping of values from Config'
|
||||
);
|
||||
|
||||
// test empty generator - no tag should appear at all
|
||||
Config::modify()->set(SiteTree::class, 'meta_generator', '');
|
||||
$meta = $page->MetaTags();
|
||||
$this->assertEquals(
|
||||
0,
|
||||
preg_match('/.*meta name=.generator..*/', $meta),
|
||||
$this->assertNotContains(
|
||||
'meta name="generator"',
|
||||
$meta,
|
||||
'test blank value means no tag generated'
|
||||
);
|
||||
|
||||
// reset original value
|
||||
Config::modify()->set(SiteTree::class, 'meta_generator', $generator);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user