Completed
Push — master ( 32f380...18c6c9 )
by Gordon
10:19
created
tests/SiteMapTest.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,24 +8,24 @@
 block discarded – undo
8 8
     {
9 9
         $this->logInWithPermission('ADMIN');
10 10
         // pages need published, fixtures are not
11
-		foreach (Page::get() as $page) {
12
-			$page->doPublish();
13
-			error_log($page->ClassName . ':' . $page->Link());
14
-		}
15
-		$response = $this->get('/sitemap/');
11
+  foreach (Page::get() as $page) {
12
+   $page->doPublish();
13
+   error_log($page->ClassName . ':' . $page->Link());
14
+  }
15
+  $response = $this->get('/sitemap/');
16 16
         $this->assertEquals(200, $response->getStatusCode());
17 17
         $positions = array();
18 18
         $body = $response->getBody();
19 19
 
20 20
         // assert is a sitemap
21
-       	$this->assertContains('<ul class="sitemap-list">', $body);
21
+        $this->assertContains('<ul class="sitemap-list">', $body);
22 22
 
23
-       	// assert root level pages
23
+        // assert root level pages
24 24
         for ($i=1; $i <= 4; $i++) {
25
-        	$row = '<li><a href="page-' . $i . '" title="Go to the Page ' . $i . ' page">Page ' . $i . '</a>';
26
-        	$this->assertContains($row, $body);
25
+         $row = '<li><a href="page-' . $i . '" title="Go to the Page ' . $i . ' page">Page ' . $i . '</a>';
26
+         $this->assertContains($row, $body);
27 27
 
28
-        	$positions["{$i}"] = strpos($body, $row);
28
+         $positions["{$i}"] = strpos($body, $row);
29 29
         }
30 30
 
31 31
         //assert order
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
         // pages need published, fixtures are not
11 11
 		foreach (Page::get() as $page) {
12 12
 			$page->doPublish();
13
-			error_log($page->ClassName . ':' . $page->Link());
13
+			error_log($page->ClassName.':'.$page->Link());
14 14
 		}
15 15
 		$response = $this->get('/sitemap/');
16 16
         $this->assertEquals(200, $response->getStatusCode());
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
        	$this->assertContains('<ul class="sitemap-list">', $body);
22 22
 
23 23
        	// assert root level pages
24
-        for ($i=1; $i <= 4; $i++) {
25
-        	$row = '<li><a href="page-' . $i . '" title="Go to the Page ' . $i . ' page">Page ' . $i . '</a>';
24
+        for ($i = 1; $i <= 4; $i++) {
25
+        	$row = '<li><a href="page-'.$i.'" title="Go to the Page '.$i.' page">Page '.$i.'</a>';
26 26
         	$this->assertContains($row, $body);
27 27
 
28 28
         	$positions["{$i}"] = strpos($body, $row);
Please login to merge, or discard this patch.
code/SiteMap.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,45 +11,45 @@
 block discarded – undo
11 11
 
12 12
 class SiteMap_Controller extends Page_Controller
13 13
 {
14
-	/**
15
-	* This function will return a unordered list of all pages on the site.
16
-	* Watch for the switch between $page and $child in the second line of the
17
-	* foreach().
18
-	*
19
-	* Note that this will only skip ErrorPage's at the top/root level of the site.
20
-	* If you have an ErrorPage class somewhere else in the hierarchy, it will be
21
-	* displayed.
22
-	*/
23
-	public function SiteMap()
24
-	{
25
-		// Pages at the root level only
26
-		$rootLevel = Page::get()->filter('ParentID', 0);
27
-		$output = '';
28
-		$output = $this->makeList($rootLevel);
29
-		return $output;
30
-	}
14
+ /**
15
+  * This function will return a unordered list of all pages on the site.
16
+  * Watch for the switch between $page and $child in the second line of the
17
+  * foreach().
18
+  *
19
+  * Note that this will only skip ErrorPage's at the top/root level of the site.
20
+  * If you have an ErrorPage class somewhere else in the hierarchy, it will be
21
+  * displayed.
22
+  */
23
+ public function SiteMap()
24
+ {
25
+  // Pages at the root level only
26
+  $rootLevel = Page::get()->filter('ParentID', 0);
27
+  $output = '';
28
+  $output = $this->makeList($rootLevel);
29
+  return $output;
30
+ }
31 31
 
32
-	private function makeList($pages)
33
-	{
34
-		$output = '';
35
-		if (count($pages)) {
36
-			$output = '
32
+ private function makeList($pages)
33
+ {
34
+  $output = '';
35
+  if (count($pages)) {
36
+   $output = '
37 37
 			<ul class="sitemap-list">';
38
-			foreach ($pages as $page) {
39
-				if (!($page instanceof ErrorPage) && $page->ShowInMenus && $page->Title != $this->Title) {
40
-					$output .= '
38
+   foreach ($pages as $page) {
39
+    if (!($page instanceof ErrorPage) && $page->ShowInMenus && $page->Title != $this->Title) {
40
+     $output .= '
41 41
 					<li><a href="'.$page->URLSegment.'" title="Go to the '.Convert::raw2xml($page->Title).' page">'.Convert::raw2xml($page->MenuTitle).'</a>';
42
-					$whereStatement = 'ParentID = '.$page->ID;
43
-					//$childPages = new DataObjectSet();
44
-					$childPages = DataObject::get('Page', $whereStatement);
45
-					$output .= $this->makeList($childPages);
46
-					$output .= '
42
+     $whereStatement = 'ParentID = '.$page->ID;
43
+     //$childPages = new DataObjectSet();
44
+     $childPages = DataObject::get('Page', $whereStatement);
45
+     $output .= $this->makeList($childPages);
46
+     $output .= '
47 47
 					</li>';
48
-				}
49
-			}
50
-			$output .= '
48
+    }
49
+   }
50
+   $output .= '
51 51
 			</ul>';
52
-		}
53
-		return $output;
54
-	}
52
+  }
53
+  return $output;
54
+ }
55 55
 }
Please login to merge, or discard this patch.