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, biapar, Willr, Ingo, swaiba, simon_w

Functional Test Director::test always returns 404


Reply

163 Views

Avatar
vtsr60

11 November 2013 at 2:55am Community Member, 1 Post

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

<?php
class FrontBasicTest extends FunctionalTest {
    protected static $fixture_file = 'mysite/tests/FrontBasicTest.yml';
   
   /**
   * Test generation of the view
   */
   public function testBasicView() {
      $response1 = Director::test('about/');
      print_r($response1);
      die();
   }
}
?>

YML File I have put this

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

RedirectorPage:
redirect_home:
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
Raj