Skip to content

Commit

Permalink
FIX Automatically redirect index action to SearchForm action (#22)
Browse files Browse the repository at this point in the history
FIX Automatically redirect index action to SearchForm action
  • Loading branch information
ScopeyNZ committed May 3, 2019
2 parents 7e70920 + f3fc1fa commit 56ab977
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/CwpSearchPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ public function __construct($dataRecord = null)
}
parent::__construct($dataRecord);
}

public function index()
{
return $this->redirect($this->Link('SearchForm'));
}
}
19 changes: 19 additions & 0 deletions tests/CwpSearchPageControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace CWP\Search\Tests;

use SilverStripe\Dev\FunctionalTest;

class CwpSearchPageControllerTest extends FunctionalTest
{
protected $usesDatabase = true;

public function testIndex()
{
$this->autoFollowRedirection = false;
$result = $this->get('/search');

$this->assertSame(302, $result->getStatusCode());
$this->assertContains('SearchForm', $result->getHeader('Location'));
}
}

0 comments on commit 56ab977

Please sign in to comment.