Global constants in PHPUnit

Is there a way to define constants in PHPUnit that can be used in all of your test suites? For example, let's say I sometimes want to test on jason.dev.mysite.com and sometimes jim.dev.mysite.com, and possibly indicate when I run the command on which site I want to test. Is this possible?

The closest I found is: http://www.phpunit.de/manual/3.4/en/appendixes.configuration.html

+6
source share
2 answers

This should be in the boot file.

Check here: http://www.phpunit.de/manual/current/en/textui.html for the bootstrap file parameter.

setUp() setUpBeforeClass(), .

+7

, , <php> XML. , , :

<phpunit bootstrap="../libraries/global/bootstrap.lib.php">
    <php>
        <env name="db_user" value="admin"/>
        <env name="db_pass" value="admin"/>
        <env name="db_host" value="127.0.0.1"/>
        <env name="db_port" value="1433"/>
        <const name="DEBUG" value="FALSE"/>
    </php>
    <testsuites>
        <testsuite name="role">
            <file>modules/role/role.test.php</file>
        </testsuite>
    </testsuites>
</phpunit>
0

All Articles