Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to have multiple test environments with different configurations?
    text
    copied!<p>I have a Symfony 2 application, which uses a REST interace. I want to execute integrations tests with different environments. The tests should be executed:</p> <ul> <li>either against a real interface (running on a specific host)</li> <li>or against a mockup interface (running on localhost).</li> </ul> <p>How can I specify, which test environment is executed? Currently I start tests using</p> <pre><code>phpunit -c app/ </code></pre> <p>from within the application folder. However I dont want to duplicate the app folder.</p> <p><strong>Update</strong></p> <p>Specifically I have a REST service, which is responsible for doint REST calls, let's call it <code>RestBase</code>. At some point it builds up a URL like: <code>$urlPrefix.$restPath</code>. <code>$urlPrefix</code> is different for <code>dev</code>, <code>stage</code>, <code>prod</code> environments. Currently this configuration is done in <code>config_*.yml</code>. However I want to run tests against different <code>urlPrefix</code>. Conceptually I want to have something like:</p> <pre><code>phpunit -c app/ **-env=test** </code></pre> <p>where <code>urlPrefix</code> is <code>http://localhost:8888</code> and</p> <pre><code>phpunit -c app/ **-env=test2** </code></pre> <p>runs against another another environment, with a different setting for <code>urlPrefix</code>.</p> <p><strong>Summarized question</strong> </p> <p>How to execute tests in another environment than <code>test</code>, e.g. <code>test2</code> (and not change this programmatically)?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload