Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4043934
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:11:24+00:00 2026-05-20T13:11:24+00:00

When I run functional tests in Symfony, my absolute links don’t appear as they

  • 0

When I run functional tests in Symfony, my absolute links don’t appear as they would even in the “real” test environment. For example, a link I output like this:

echo url_for("@homepage", true);

it will show up as http://localhost/index.php/, whereas if I actually visit the test site in my browser, it’ll show up as http://example.com.localhost/frontend_test.php/

Now, I’m assuming this is happening because the test environment doesn’t know anything about my local virtual server setup, etc., so it has no way of knowing what its “real” absolute URL should be.

But this makes my tests more difficult, and less “real”. Making my tests pass by matching some odd link that wouldn’t actually work if I were to click on it feels a bit wrong.

Maybe the best result would be if my test browser’s absolute links looked the same as my real environment’s absolute links, so I can easily test the results against the values that the real system would output, e.g. an absolute link to the homepage would look like it did in the live system:

http://example.com/

instead of

http://localhost/index.php

How do people normally deal with this? Can I “tell” the test browser where its absolute URLs should be based, in terms of hostname and controller, including dropping “index.php”, and so get more realistic URLs out of the test framework?

(These URLs are being generated for an Atom feed and in emails, which is why I need them to be absolute. Relative links are working fine.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:11:25+00:00Added an answer on May 20, 2026 at 1:11 pm

    In my opinion your website should work with ANY domain. Testing for host name ties tests to it.

    I think what you need is to check if the link is absolute or not (easily done with regexp).

    I can hardly find a need for testing specific domain (unless you’re using multiple domains; in such case domains should be configurable anyways).

    EDIT:

    You can actually change the host name with first parameter passed to the browser’s constructor:

    $test = new sfTestFunctional(new sfBrowser('mydomain.com'));
    

    I never tried it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can run tasks as part of our functional tests just fine using this
I know how to run functional/integration tests in Rails, this question is about best
I'm trying to write a functional test for an action that must run over
I'm using selenium to run some functional tests on the UI for our current
I'm trying to use Maven Failsafe Plugin to run my functional/integration tests, according to
When I run a simple functional test to get (for example) the users/signIn page,
I have a series of functional tests against a web application that correctly run,
When I run a post in my Rails functional test setup do post :create,
Here's my problem. If I run the test using the ruby command the tests
I'm trying to upgrade my rails application to Rails3. When I run functional tests,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.