Jump to:

23376 Posts in 18176 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Functional tests fail

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

Page: 1
Go to End
Author Topic: 692 Views
  • Shane Garelja
    Avatar
    Community Member
    18 Posts

    Functional tests fail Link to this post

    Hi,

    I'm trying to write some functional tests but am having an issue getting a valid page back when using Director::test(). All I get is a 404 - page not found.

    I have a simple test that calls:

    $response1 = Director::test('contact/');
    Debug::show("<!-- START ".$response1->getBody()." END -->");

    The debug output shows HTML for the 404 page... so my test obviously fails because the HTML code I'm asserting to validate the page loaded properly is absent.

    What am I missing here?

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Functional tests fail Link to this post

    Is your contact page in your yaml file. Tests run in a 'new' database and not your sites database so any pages you have setup via the CMS won't be there.

  • Shane Garelja
    Avatar
    Community Member
    18 Posts

    Re: Functional tests fail Link to this post

    Ahhh - yep. That's what I'm missing Thanks Will! Much appreciated.

    692 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.