简体   繁体   中英

PHPUnit: bootstrap not being executed?

When running a test, my phpunit.xml is being loaded by PHPUnit. I can see it in the console as --bootstrap parameter, but it seems like it's not being executed?

In the xml I set bootstrap="bootstrap.php" Is it normal that the xml file contents are echoed just below the line Testing started at... and just above PHPUnit 3.7.21 by Sebastian Bergmann. ? Any way in my bootstrap.php file I just put

die "bootstrap executed";

But never see that. What could be wrong?

Edit: This is the contents of phpunit.xml:

<phpunit bootstrap="./bootstrap.php">
</phpunit>

You need to launch the phpunit in one of the following example:

#for load a bootstrap php file (with full path and file extension)
>phpunit --bootstrap bootstrap.php

or

#for load with your xml configuration
>phpunit -c phpunit.xml

Hope this help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM