diff --git a/.travis.yml b/.travis.yml
index 8794572..f9bcf15 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,27 +1,33 @@
-# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details
-
-sudo: false
-
language: php
-php:
- - 5.5
- - 5.6
- - 7.0
+dist: trusty
env:
- - DB=MYSQL CORE_RELEASE=master
+ global:
+ - COMPOSER_ROOT_VERSION=2.x-dev
matrix:
include:
- php: 5.6
- env: DB=PGSQL CORE_RELEASE=master
+ env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1
+ - php: 7.0
+ env: DB=MYSQL PHPUNIT_TEST=1
+ - php: 7.1
+ env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
before_script:
- - composer self-update || true
- - git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
- - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- - cd ~/builds/ss
+ # Init PHP
+ - phpenv rehash
+ - phpenv config-rm xdebug.ini
+ - composer validate
+ - composer require silverstripe/recipe-cms 1.0.x-dev --no-update
+ - if [[ $DB == PGSQL ]]; then composer require silverstripe/postgresql:2.0.x-dev --no-update; fi
+ - composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
script:
- - vendor/bin/phpunit googlesitemaps/tests
+ - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/; fi
+ - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
+ - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src/ tests/ ; fi
+
+after_success:
+ - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..3e41eee
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,14 @@
+
+
+ tests
+
+
+
+
+ src/
+
+ tests/
+
+
+
+
diff --git a/src/Extensions/GoogleSitemapExtension.php b/src/Extensions/GoogleSitemapExtension.php
index 005d1bc..75e64e4 100644
--- a/src/Extensions/GoogleSitemapExtension.php
+++ b/src/Extensions/GoogleSitemapExtension.php
@@ -38,13 +38,17 @@ class GoogleSitemapExtension extends DataExtension
$can = $this->owner->getGooglePriority();
}
+ if ($can === false) {
+ return false;
+ }
+
// Allow override. In this case, since this can return multiple results, we'll use an "and" based policy. That is
// if any value is false then the current value will be false. Only only if all are true will we then return true.
$override = $this->owner->invokeWithExtensions('alterCanIncludeInGoogleSitemap', $can);
- if ($override) {
- $can = min($override);
- }
+ if ($override) {
+ $can = min($override, $can);
+ }
return $can;
}
diff --git a/src/GoogleSitemap.php b/src/GoogleSitemap.php
index c9fe2b3..07ca5be 100644
--- a/src/GoogleSitemap.php
+++ b/src/GoogleSitemap.php
@@ -2,7 +2,6 @@
namespace Wilr\GoogleSitemaps;
-use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Director;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
@@ -14,7 +13,10 @@ use SilverStripe\View\ArrayData;
use SilverStripe\Core\Extensible;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Core\Config\Configurable;
+use Wilr\GoogleSitemaps\Extensions\GoogleSitemapExtension;
use ReflectionClass;
+use ReflectionException;
+
/**
* Sitemaps are a way to tell Google about pages on your site that they might
* not otherwise discover. In its simplest terms, a XML Sitemap usually called
@@ -24,16 +26,18 @@ use ReflectionClass;
* all the pages on your site, including URLs that may not be discoverable by
* Google's normal crawling process.
*
- * The GoogleSitemap handle requests to 'sitemap.xml'
- * the other two classes are used to render the sitemap.
+ * The GoogleSitemap handle requests to 'sitemap.xml' the other two classes are
+ * used to render the sitemap.
*
- * You can notify ("ping") Google about a changed sitemap
- * automatically whenever a new page is published or unpublished.
- * By default, Google is not notified, and will pick up your new
- * sitemap whenever the GoogleBot visits your website.
+ * You can notify ("ping") Google about a changed sitemap automatically whenever
+ * a new page is published or unpublished.
+ *
+ * By default, Google is not notified, and will pick up your new sitemap
+ * whenever the GoogleBot visits your website.
*
* To Enable notification of Google after every publish set google_notification_enabled
* to true in the googlesitemaps.yml config file.
+ *
* This file is usually located in the _config folder of your project folder.
* e.g mysite/_config/googlesitemaps.yml
*
@@ -42,7 +46,7 @@ use ReflectionClass;
* Name: customgooglesitemaps
* After: googlesitemaps
* ---
- * GoogleSitemap:
+ * Wilr\GoogleSitemaps\GoogleSitemap:
* enabled: true
* objects_per_sitemap: 1000
* google_notification_enabled: true
@@ -63,7 +67,7 @@ class GoogleSitemap
*
* @var array
*/
- private static $dataobjects = array();
+ private static $dataobjects = [];
/**
* List of custom routes to include in the sitemap (such as controller
@@ -71,7 +75,7 @@ class GoogleSitemap
*
* @var array
*/
- private static $routes = array();
+ private static $routes = [];
/**
* @config
@@ -97,7 +101,7 @@ class GoogleSitemap
public static function register_dataobject($className, $changeFreq = 'monthly', $priority = '0.6')
{
if (!self::is_registered($className)) {
- $className::add_extension('GoogleSitemapExtension');
+ $className::add_extension(GoogleSitemapExtension::class);
self::$dataobjects[$className] = array(
'frequency' => ($changeFreq) ? $changeFreq : 'monthly',
@@ -242,8 +246,8 @@ class GoogleSitemap
Translatable::disable_locale_filter();
}
- if ($class == SiteTree::class) {
- $instances = Versioned::get_by_stage(SiteTree::class, 'Live');
+ if ($class == 'SilverStripe\CMS\Model\SiteTree') {
+ $instances = Versioned::get_by_stage('SilverStripe\CMS\Model\SiteTree', 'Live');
if($filter) {
$instances = $instances->filter('ShowInSearch', 1);
@@ -358,7 +362,7 @@ class GoogleSitemap
$sitemaps = new ArrayList();
$filter = Config::inst()->get(__CLASS__, 'use_show_in_search');
- if (class_exists(SiteTree::class)) {
+ if (class_exists('SilverStripe\CMS\Model\SiteTree')) {
// move to extension hook. At the moment moduleexists config hook
// does not work.
if (class_exists('Translatable')) {
@@ -366,7 +370,7 @@ class GoogleSitemap
}
$filter = ($filter) ? "\"ShowInSearch\" = 1" : "";
- $class = SiteTree::class;
+ $class = 'SilverStripe\CMS\Model\SiteTree';
$instances = Versioned::get_by_stage($class, 'Live', $filter);
$this->extend("alterDataList", $instances, $class);
$count = $instances->count();
@@ -382,7 +386,7 @@ class GoogleSitemap
$lastModified = ($lastEdited) ? date('Y-m-d', strtotime($lastEdited)) : date('Y-m-d');
$sitemaps->push(new ArrayData(array(
- 'ClassName' => $this->sanitiseClassName(SiteTree::class),
+ 'ClassName' => $this->sanitiseClassName('SilverStripe\CMS\Model\SiteTree'),
'LastModified' => $lastModified,
'Page' => $i
)));
diff --git a/tests/GoogleSitemapTest.php b/tests/GoogleSitemapTest.php
index de9c8ce..3233456 100644
--- a/tests/GoogleSitemapTest.php
+++ b/tests/GoogleSitemapTest.php
@@ -1,6 +1,7 @@
getSitemaps() instead of ::get_sitemaps()).
- *
- * @package googlesitemaps
- * @subpackage tests
- */
class GoogleSitemapTest extends FunctionalTest
{
- public static $fixture_file = 'googlesitemaps/tests/GoogleSitemapTest.yml';
+ protected static $fixture_file = 'GoogleSitemapTest.yml';
- protected $extraDataObjects = array(
- 'GoogleSitemapTest_DataObject',
- 'GoogleSitemapTest_OtherDataObject',
- 'GoogleSitemapTest_UnviewableDataObject',
- 'SilverStripe\GoogleSitemaps\Test_DataObject',
- );
+ protected static $extra_dataobjects = [
+ TestDataObject::class,
+ OtherDataObject::class,
+ UnviewableDataObject::class
+ ];
+
+ protected static $extra_extensions = [
+ GoogleSitemapExtension::class
+ ];
public function setUp()
{
parent::setUp();
if (class_exists('Page')) {
- $this->loadFixture('googlesitemaps/tests/GoogleSitemapPageTest.yml');
+ $this->loadFixture($this->resolveFixturePath('GoogleSitemapPageTest.yml'));
}
GoogleSitemap::clear_registered_dataobjects();
@@ -49,6 +53,17 @@ class GoogleSitemapTest extends FunctionalTest
GoogleSitemap::clear_registered_routes();
}
+ public function testCanIncludeInGoogleSitemap()
+ {
+ GoogleSitemap::register_dataobject(TestDataObject::class, '');
+
+ $unused = $this->objFromFixture(TestDataObject::class, 'UnindexedDataObject');
+ $this->assertFalse($unused->canIncludeInGoogleSitemap());
+
+ $used = $this->objFromFixture(TestDataObject::class, 'DataObjectTest2');
+ $this->assertTrue($used->canIncludeInGoogleSitemap());
+ }
+
public function testIndexFileWithCustomRoute()
{
GoogleSitemap::register_route('/test/');
@@ -63,9 +78,9 @@ class GoogleSitemapTest extends FunctionalTest
public function testGetItems()
{
- GoogleSitemap::register_dataobject("GoogleSitemapTest_DataObject", '');
+ GoogleSitemap::register_dataobject(TestDataObject::class, '');
- $items = GoogleSitemap::get_items('GoogleSitemapTest_DataObject', 1);
+ $items = GoogleSitemap::get_items(TestDataObject::class, 1);
$this->assertEquals(2, $items->count());
$this->assertDOSEquals(array(
@@ -73,11 +88,11 @@ class GoogleSitemapTest extends FunctionalTest
array("Priority" => "0.4")
), $items);
- GoogleSitemap::register_dataobject("GoogleSitemapTest_OtherDataObject");
- $this->assertEquals(1, GoogleSitemap::get_items('GoogleSitemapTest_OtherDataObject', 1)->count());
+ GoogleSitemap::register_dataobject(OtherDataObject::class);
+ $this->assertEquals(1, GoogleSitemap::get_items(OtherDataObject::class, 1)->count());
- GoogleSitemap::register_dataobject("GoogleSitemapTest_UnviewableDataObject");
- $this->assertEquals(0, GoogleSitemap::get_items('GoogleSitemapTest_UnviewableDataObject', 1)->count());
+ GoogleSitemap::register_dataobject(UnviewableDataObject::class);
+ $this->assertEquals(0, GoogleSitemap::get_items(UnviewableDataObject::class, 1)->count());
}
public function testGetItemsWithCustomRoutes()
@@ -94,27 +109,27 @@ class GoogleSitemapTest extends FunctionalTest
public function testAccessingSitemapRootXMLFile()
{
- GoogleSitemap::register_dataobject("GoogleSitemapTest_DataObject");
- GoogleSitemap::register_dataobject("GoogleSitemapTest_OtherDataObject");
+ GoogleSitemap::register_dataobject(TestDataObject::class);
+ GoogleSitemap::register_dataobject(OtherDataObject::class);
$response = $this->get('sitemap.xml');
$body = $response->getBody();
// the sitemap should contain to both those files and not the other
// dataobject as it hasn't been registered
- $expected = "". Director::absoluteURL("sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1") ."";
+ $expected = "". Director::absoluteURL("sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1") ."";
$this->assertEquals(1, substr_count($body, $expected), 'A link to GoogleSitemapTest_DataObject exists');
- $expected = "". Director::absoluteURL("sitemap.xml/sitemap/GoogleSitemapTest_OtherDataObject/1") ."";
+ $expected = "". Director::absoluteURL("sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-OtherDataObject/1") ."";
$this->assertEquals(1, substr_count($body, $expected), 'A link to GoogleSitemapTest_OtherDataObject exists');
- $expected = "". Director::absoluteURL("sitemap.xml/sitemap/GoogleSitemapTest_UnviewableDataObject/2") ."";
+ $expected = "". Director::absoluteURL("sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-UnviewableDataObject/2") ."";
$this->assertEquals(0, substr_count($body, $expected), 'A link to a GoogleSitemapTest_UnviewableDataObject does not exist');
}
public function testLastModifiedDateOnRootXML()
{
- Config::inst()->update('GoogleSitemap', 'enabled', true);
+ Config::inst()->update(GoogleSitemap::class, 'enabled', true);
if (!class_exists('Page')) {
$this->markTestIncomplete('No cms module installed, page related test skipped');
@@ -142,18 +157,18 @@ class GoogleSitemapTest extends FunctionalTest
public function testIndexFilePaginatedSitemapFiles()
{
$original = Config::inst()->get('GoogleSitemap', 'objects_per_sitemap');
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', 1);
- GoogleSitemap::register_dataobject("GoogleSitemapTest_DataObject");
+ Config::inst()->update(GoogleSitemap::class, 'objects_per_sitemap', 1);
+ GoogleSitemap::register_dataobject(TestDataObject::class);
$response = $this->get('sitemap.xml');
$body = $response->getBody();
- $expected = "". Director::absoluteURL("sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1") ."";
+ $expected = "". Director::absoluteURL("sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1") ."";
$this->assertEquals(1, substr_count($body, $expected), 'A link to the first page of GoogleSitemapTest_DataObject exists');
- $expected = "". Director::absoluteURL("sitemap.xml/sitemap/GoogleSitemapTest_DataObject/2") ."";
+ $expected = "". Director::absoluteURL("sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/2") ."";
$this->assertEquals(1, substr_count($body, $expected), 'A link to the second page GoogleSitemapTest_DataObject exists');
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', $original);
+ Config::inst()->update(GoogleSitemap::class, 'objects_per_sitemap', $original);
}
public function testRegisterRoutesIncludesAllRoutes()
@@ -175,57 +190,15 @@ class GoogleSitemapTest extends FunctionalTest
public function testAccessingNestedSiteMap()
{
$original = Config::inst()->get('GoogleSitemap', 'objects_per_sitemap');
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', 1);
- GoogleSitemap::register_dataobject("GoogleSitemapTest_DataObject");
+ Config::inst()->update(GoogleSitemap::class, 'objects_per_sitemap', 1);
+ GoogleSitemap::register_dataobject(TestDataObject::class);
- $response = $this->get('sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1');
+ $response = $this->get('sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1');
$body = $response->getBody();
$this->assertEquals(200, $response->getStatusCode(), 'successful loaded nested sitemap');
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', $original);
- }
-
- public function testAccessingNestedSiteMapCaseInsensitive()
- {
- $original = Config::inst()->get('GoogleSitemap', 'objects_per_sitemap');
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', 1);
- GoogleSitemap::register_dataobject("GoogleSitemapTest_DataObject");
-
- $response = $this->get('sitemap.xml/sitemap/googlesitemaptest_dataobject/1');
- $body = $response->getBody();
-
- $this->assertEquals(200, $response->getStatusCode(), 'successful loaded nested sitemap');
-
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', $original);
- }
-
- public function testAccessingNestedNamespacedSiteMap()
- {
- $original = Config::inst()->get('GoogleSitemap', 'objects_per_sitemap');
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', 1);
- GoogleSitemap::register_dataobject("SilverStripe\\GoogleSitemaps\\Test_DataObject");
-
- $response = $this->get('sitemap.xml/sitemap/SilverStripe-GoogleSitemaps-Test_DataObject/1');
- $body = $response->getBody();
-
- $this->assertEquals(200, $response->getStatusCode(), 'successful loaded nested sitemap');
-
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', $original);
- }
-
- public function testAccessingNestedNamespacedSiteMapCaseInsensitive()
- {
- $original = Config::inst()->get('GoogleSitemap', 'objects_per_sitemap');
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', 1);
- GoogleSitemap::register_dataobject("SilverStripe\\GoogleSitemaps\\Test_DataObject");
-
- $response = $this->get('sitemap.xml/sitemap/silverstripe-googlesitemaps-test_dataobject/1');
- $body = $response->getBody();
-
- $this->assertEquals(200, $response->getStatusCode(), 'successful loaded nested sitemap');
-
- Config::inst()->update('GoogleSitemap', 'objects_per_sitemap', $original);
+ Config::inst()->update(GoogleSitemap::class, 'objects_per_sitemap', $original);
}
public function testGetItemsWithPages()
@@ -245,41 +218,40 @@ class GoogleSitemapTest extends FunctionalTest
$this->assertDOSContains(array(
array('Title' => 'Testpage1'),
array('Title' => 'Testpage2')
- ), GoogleSitemap::get_items(SiteTree::class), "There should be 2 pages in the sitemap after publishing");
+ ), GoogleSitemap::get_items('\SilverStripe\CMS\Model\SiteTree'), "There should be 2 pages in the sitemap after publishing");
// check if we make a page readonly that it is hidden
$page2->CanViewType = 'LoggedInUsers';
$page2->write();
$page2->publish('Stage', 'Live');
- $this->session()->inst_set('loggedInAs', null);
+ $this->logOut();
$this->assertDOSEquals(array(
array('Title' => 'Testpage1')
- ), GoogleSitemap::get_items(SiteTree::class), "There should be only 1 page, other is logged in only");
+ ), GoogleSitemap::get_items('\SilverStripe\CMS\Model\SiteTree'), "There should be only 1 page, other is logged in only");
}
public function testAccess()
{
- Config::inst()->update('GoogleSitemap', 'enabled', true);
+ Config::inst()->update(GoogleSitemap::class, 'enabled', true);
$response = $this->get('sitemap.xml');
$this->assertEquals(200, $response->getStatusCode(), 'Sitemap returns a 200 success when enabled');
$this->assertEquals('application/xml; charset="utf-8"', $response->getHeader('Content-Type'));
- GoogleSitemap::register_dataobject("GoogleSitemapTest_DataObject");
- $response = $this->get('sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1');
+ GoogleSitemap::register_dataobject(TestDataObject::class);
+ $response = $this->get('sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1');
$this->assertEquals(200, $response->getStatusCode(), 'Sitemap returns a 200 success when enabled');
$this->assertEquals('application/xml; charset="utf-8"', $response->getHeader('Content-Type'));
- Config::inst()->remove('GoogleSitemap', 'enabled');
- Config::inst()->update('GoogleSitemap', 'enabled', false);
+ Config::inst()->update(GoogleSitemap::class, 'enabled', false);
$response = $this->get('sitemap.xml');
$this->assertEquals(404, $response->getStatusCode(), 'Sitemap index returns a 404 when disabled');
- $response = $this->get('sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1');
+ $response = $this->get('sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1');
$this->assertEquals(404, $response->getStatusCode(), 'Sitemap file returns a 404 when disabled');
}
@@ -322,16 +294,16 @@ class GoogleSitemapTest extends FunctionalTest
public function testUnpublishedPage()
{
- if (!class_exists(SiteTree::class)) {
+ if (!class_exists('SilverStripe\CMS\SiteTree')) {
$this->markTestSkipped('Test skipped; CMS module required for testUnpublishedPage');
}
- $orphanedPage = new SiteTree();
+ $orphanedPage = new \SilverStripe\CMS\SiteTree();
$orphanedPage->ParentID = 999999; // missing parent id
$orphanedPage->write();
$orphanedPage->publish("Stage", "Live");
- $rootPage = new SiteTree();
+ $rootPage = new \SilverStripe\CMS\SiteTree();
$rootPage->ParentID = 0;
$rootPage->write();
$rootPage->publish("Stage", "Live");
@@ -352,69 +324,3 @@ class GoogleSitemapTest extends FunctionalTest
// }
}
}
-
-/**
- * @package googlesitemaps
- * @subpackage tests
- */
-class GoogleSitemapTest_DataObject extends DataObject implements TestOnly
-{
-
- private static $db = array(
- 'Priority' => 'Varchar(10)'
- );
-
- public function canView($member = null)
- {
- return true;
- }
-
- public function AbsoluteLink()
- {
- return Director::absoluteBaseURL();
- }
-}
-
-/**
- * @package googlesitemaps
- * @subpackage tests
- */
-class GoogleSitemapTest_OtherDataObject extends DataObject implements TestOnly
-{
-
- private static $db = array(
- 'Priority' => 'Varchar(10)'
- );
-
- public function canView($member = null)
- {
- return true;
- }
-
- public function AbsoluteLink()
- {
- return Director::absoluteBaseURL();
- }
-}
-
-/**
- * @package googlesitemaps
- * @subpackage tests
- */
-class GoogleSitemapTest_UnviewableDataObject extends DataObject implements TestOnly
-{
-
- private static $db = array(
- 'Priority' => 'Varchar(10)'
- );
-
- public function canView($member = null)
- {
- return false;
- }
-
- public function AbsoluteLink()
- {
- return Director::absoluteBaseURL();
- }
-}
diff --git a/tests/GoogleSitemapTest.yml b/tests/GoogleSitemapTest.yml
index 577e68e..52952df 100644
--- a/tests/GoogleSitemapTest.yml
+++ b/tests/GoogleSitemapTest.yml
@@ -1,4 +1,4 @@
-GoogleSitemapTest_DataObject:
+Wilr\GoogleSitemaps\Tests\Model\TestDataObject:
DataObjectTest1:
Priority: 0.4
DataObjectTest2:
@@ -6,10 +6,10 @@ GoogleSitemapTest_DataObject:
UnindexedDataObject:
Priority: -1
-GoogleSitemapTest_OtherDataObject:
+Wilr\GoogleSitemaps\Tests\Model\OtherDataObject:
OtherDataObjectTest2:
Priority: 0.3
-GoogleSitemapTest_UnviewableDataObject:
+Wilr\GoogleSitemaps\Tests\Model\UnviewableDataObject:
Unviewable1:
Priority: 0.4
diff --git a/tests/NamespacedTestObject.php b/tests/Model/OtherDataObject.php
similarity index 68%
rename from tests/NamespacedTestObject.php
rename to tests/Model/OtherDataObject.php
index c3adcc0..1f2c3c3 100644
--- a/tests/NamespacedTestObject.php
+++ b/tests/Model/OtherDataObject.php
@@ -1,16 +1,16 @@
'Varchar(10)'
- ];
+ );
public function canView($member = null)
{
diff --git a/tests/Model/TestDataObject.php b/tests/Model/TestDataObject.php
new file mode 100644
index 0000000..a0f104a
--- /dev/null
+++ b/tests/Model/TestDataObject.php
@@ -0,0 +1,26 @@
+ 'Varchar(10)'
+ );
+
+ public function canView($member = null)
+ {
+ return true;
+ }
+
+ public function AbsoluteLink()
+ {
+ return Director::absoluteBaseURL();
+ }
+}
diff --git a/tests/Model/UnviewableDataObject.php b/tests/Model/UnviewableDataObject.php
new file mode 100644
index 0000000..5b367d4
--- /dev/null
+++ b/tests/Model/UnviewableDataObject.php
@@ -0,0 +1,25 @@
+ 'Varchar(10)'
+ );
+
+ public function canView($member = null)
+ {
+ return false;
+ }
+
+ public function AbsoluteLink()
+ {
+ return Director::absoluteBaseURL();
+ }
+}
diff --git a/xsl/xml-sitemap.xsl b/xsl/xml-sitemap.xsl
index 4b95c55..d482e8c 100644
--- a/xsl/xml-sitemap.xsl
+++ b/xsl/xml-sitemap.xsl
@@ -7,7 +7,6 @@
XML Sitemap
-