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'm trying to upgrade my rails application to Rails3. When I run functional tests,
I have a Pylons 1.0 app with a bunch of tests in the test/functional
I'm trying to write a functional test for an action that must run over
We're currently having issues with memory leaks when using unit tests with Symfony 1.x
I'm finding the feedback look pretty slow when running integration and functional tests in
I'm using TestNG to run tests in parallel and want to be careful about
I want to run some unittests. For this tests I need to use another
After installing phpUnit 3.5 i am trying to run my tests this way: phpunit
I'm trying to setup a unit test but whenever I run phpunit -c app
I have a series of HTML tests that I am able to run using

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.