mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-10-22 11:05:48 +02:00
Merge pull request #85 from dhensby/pulls/case-class
Allow URLs to be case insensitive
This commit is contained in:
commit
82778473a8
@ -182,6 +182,15 @@ class GoogleSitemap {
|
||||
* @return ArrayList
|
||||
*/
|
||||
public static function get_items($class, $page = 1) {
|
||||
//normalise the class name
|
||||
try {
|
||||
$reflectionClass = new ReflectionClass($class);
|
||||
$class = $reflectionClass->getName();
|
||||
} catch (ReflectionException $e) {
|
||||
// this can happen when $class is GoogleSitemapRoute
|
||||
//we should try to carry on
|
||||
}
|
||||
|
||||
$output = new ArrayList();
|
||||
$count = Config::inst()->get('GoogleSitemap', 'objects_per_sitemap');
|
||||
$filter = Config::inst()->get('GoogleSitemap', 'use_show_in_search');
|
||||
|
@ -161,6 +161,19 @@ class GoogleSitemapTest extends FunctionalTest {
|
||||
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 testGetItemsWithPages() {
|
||||
if(!class_exists('Page')) {
|
||||
$this->markTestIncomplete('No cms module installed, page related test skipped');
|
||||
|
Loading…
Reference in New Issue
Block a user