Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Functional Test Director::test always returns 404

Go to End

3 Posts   843 Views


Community Member, 1 Post

11 November 2013 at 2:55am

Hi I am trying out the Unit testing in SilverStripe, I got stuck, I am pretty new to SilverStripe.

My Unit test files looks like this

class FrontBasicTest extends FunctionalTest {
protected static $fixture_file = 'mysite/tests/FrontBasicTest.yml';

* Test generation of the view
public function testBasicView() {
$response1 = Director::test('about/');

YML File I have put this

Title: Home
Title: About Us
Title: Staff
URLSegment: my-staff
Parent: =>Page.about

RedirectionType: Internal
LinkTo: =>Page.home

I tried different things, but I always get 404 error page as the Print output.

But If I access the admin page it working as expected, for example 'admin/pages' is returning login page.

My main aim to to grab HTML of the front site page and check for particular div present, So Please let me know what I am doing worng, How can I grab the HTML of the front site page in unit test.

Thank you


Community Member, 2 Posts

13 November 2015 at 2:51pm

Hi Raj,
This seems to be like your caching issue or environment variable issue.

Check your _ss_environment file,php Grant all privileges to the user of your database.

Try deleting your cache from /tmp/ folder.
Run dev/build/?flush=1

And then run phpunit from command line using sudo root user
If you are working on ubuntu => sudo -u www:data phpunit path/to/file

See if this helps.


Community Member, 26 Posts

31 May 2016 at 1:12pm

I've had this and your pages are not published. The solution is to publish all your pages, or use the draft pages with this call