Skip to content

Commit

Permalink
Added details of which Composer scripts do which workarounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
joachim-n committed Jan 11, 2021
1 parent 3fa774b commit 58a0c2f
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,38 @@ Several workarounds are necessary to make Drupal core work correctly when symlin

The vendor folder has to be symlinked into the Drupal core repository, because otherwise code in core that expects to find a Composer autoloader fails.

This is done by a Composer script after initial installation.
This is done by a Composer script after initial installation:

```
ln -s ../../vendor ./repos/drupal/vendor
```

### App root index.php patch

The index.php scaffold file has to be patched after it has been copied to web/index.php, because otherwise DrupalKernel guesses the Drupal app root as incorrectly being inside the Drupal core git clone, which means it can't find the settings.php file.

This is done by a Composer script after initial installation.
This is done by a Composer script after initial installation:

```
cd web && patch -p1 <../scaffold/scaffold-patch-index-php.patch
```

See https://www.drupal.org/project/drupal/issues/3188703 for more detail.

### Browser test output
### Simpletest folder

The HTML files output from Browser tests are written into the Drupal core git clone, and so the URLs shown in PHPUnit output are incorrect. The simpletest folder needs to be symlinked into the Drupal core git clone.
When running browser tests, the initial setup of Drupal in FunctionalTestSetupTrait::prepareEnvironment() creates a site folder using the real file locations with symlinks resolved, thus `repos/drupal/sites/simpletest`, but during the request to the test site, Drupal looks in `/web/sites/simpletest`.

This is done by a Composer script after initial installation.
Additionally, the HTML files output from Browser tests are written into the Drupal core git clone, and so the URLs shown in PHPUnit output are incorrect.

### Simpletest folder
The fix for both of these is to create the simpletest site folder in the web root and symlink it into the Drupal core git clone.

This is done by a Composer script after initial installation:

When running browser tests, the initial setup of Drupal creates a site folder using the real file locations with symlinks resolved, thus `repos/drupal/sites/simpletest`, but during the request to the test site, Drupal looks in `/web/sites/simpletest`. See the section on running tests for the workaround.
```
mkdir -p web/sites/simpletest
ln -s ../../../web/sites/simpletest repos/drupal/sites
```

## How it works

Expand Down

0 comments on commit 58a0c2f

Please sign in to comment.