Skip to content
Advertisement

Bypass SIMPLETEST_BASE_URL in PHPUnit.xml

Is there any way to run PHPUnit test case without SIMPLETEST_BASE_URL. I need to perform PHPUnit in an environment where only PHP cli is availabe. So can’t put any url on SIMPLETEST_BASE_URL in phpunit.xml. So is there is any work around?

Advertisement

Answer

PHPUnit configuration provides sensible defaults that makes it possible to run test suites right off the bat without including a configuration file for a project.

Possible configuration options exposed as configurable in the configuration file are documented. There is no mention of SIMPLETEST_BASE_URL.

SIMPLETEST_BASE_URL is specific to Drupal projects and required in functional tests that are subclasses of DrupalTestsBrowserTestBase or use DrupalCoreTestFunctionalTestSetupTrait

If you are not writing any tests that require testing certain functionality on an installed site, you can subclass PHPUnitFrameworkTestCase for your unit tests.

Even so the PHP CLI comes with a builtin webserver so I reckon one should be able to set SIMPLETEST_BASE_URL to localhost.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement