Drupal 7 simpletest fails in docker

131 Views Asked by At

I have a docker container (build on php:7.1-apache image) with a Drupal 7.56 plain installation.

My simpletest starts with this:

$this->account = $this->drupalCreateUser();
$this->drupalLogin($this->account);

But when I run the following command:

docker exec simpletest bash -c "php scripts/run-tests.sh --url http://simpletest \
--verbose --color --class MyOwnWebTest"

I get the following message a bit down:

Fail      User login my_module   34 
MyOwnWebTest->testWeb
User esxlZnK0 successfully logged in.

It doesn't make any sence - the user is created and logged in, but the code fails?!

1

There are 1 best solutions below

0
Lars Hansen On

Okay - figured it out for my self.

The container is setup to listen to port 83. So Apache's port.conf must have a Listen 81 and Drupals settings.php must have the following setting:

$base_url = 'http://simpletest:83';

And I am calling the test with this code line:

docker exec simpletest bash -c "php scripts/run-tests.sh \
--url http://simpletest:83 --verbose --color --class MyOwnWebTest"