Skip to content
Permalink
Browse files

Do not attempt sitemap test if Sitemap is huge

  • Loading branch information...
chrisgraham committed May 15, 2019
1 parent bf8f15f commit a4680de303b7116fafc2762af2728e8b6ef34730
Showing with 25 additions and 0 deletions.
  1. +25 −0 _tests/tests/unit_tests/sitemap.php
@@ -23,6 +23,11 @@ class sitemap_test_set extends cms_test_case
public function setUp()
{
if ($GLOBALS['SITE_DB']->query_select_value('sitemap_cache', 'COUNT(*)') > 3000) {
$this->assertTrue(false, 'Test will not work on databases with a huge sitemap');
return;
}
$this->establish_admin_session();
require_code('sitemap');
@@ -71,6 +76,10 @@ public function flatten_sitemap($sitemap)
public function testIsConclusive()
{
if ($this->sitemap === null) {
return;
}
// Test we have an arbitrary entry-point, just to ensure things are still generating deeply
$this->assertTrue(isset($this->flattened['adminzone:admin_config:base']));
@@ -80,6 +89,10 @@ public function testIsConclusive()
public function testPageGroupingHelpDocsDefined()
{
if ($this->sitemap === null) {
return;
}
$applicable_page_groupings = array(
'audit',
'security',
@@ -127,6 +140,10 @@ public function testPageGroupingHelpDocsDefined()
public function testHasIcons()
{
if ($this->sitemap === null) {
return;
}
foreach ($this->flattened as $k => $c) {
if (preg_match('#^\w*:(\w*(:\w*)?)?$#', $k) != 0) {
if (in_array($k, array( // Exceptions
@@ -158,13 +175,21 @@ public function testHasIcons()
public function testNoOrphans()
{
if ($this->sitemap === null) {
return;
}
foreach ($this->flattened as $c) {
$this->assertTrue(!isset($c['is_unexpected_orphan']), 'Not tied in via page grouping ' . $c['title']->evaluate());
}
}
public function testNoIncompleteNodes()
{
if ($this->sitemap === null) {
return;
}
$props = array(
'title',
'content_type',

0 comments on commit a4680de

Please sign in to comment.
You can’t perform that action at this time.