22
33## Composer sandbox
44
5- This plugin uses a special sandbox which allows it to run composer as a separate process during testing.
6-
7- A fake local packagist repository is created from [ package definitions] ( /tests/Functional/Fixtures/Packages )
8- for the purpose of testing by using internally [ Satis] ( https://github.com/composer/satis ) as a library.
5+ This plugin uses a special sandbox which allows it to run composer as a separate process during testing which creates:
6+ - Fake local composer repository in ` /repo/packages.json ` with all packages defined [ package fixtures] ( /tests/Functional/Fixtures/Packages/ ) .
7+ - Isolated ` COMPOSER_HOME ` with configuration in ` /composer/config.json ` that disabled packagist and configures the above repository.
8+ - Project directories in ` /project/{test_run} ` used for storing dynamically constructed
9+ project used for testing.
910
1011See the [ ComposerSandbox] ( /tests/Functional/Fixtures/ComposerSandbox.php ) class for the details.
1112
@@ -18,4 +19,34 @@ vendor/bin/phpunit --debug
1819```
1920
2021It's nice to also add the ` --testdox ` switch then.
22+
23+ ### Override test sandbox settings via environment variables
24+
25+ #### ` COMPOSER_SANDBOX_TMPDIR="{{ sys_get_temp_dir() }}" ` - Base temporary dir
26+
27+ _ Path to base directory used to store temporary files needed for running the tests._
28+
29+ > ** Warning!** Never place ` TEST_TMP ` dir inside your project's working tree as this
30+ > will cause composer to attempt recursively install its own files and all
31+ > hell breaks loose.
32+ #### ` COMPOSER_SANDBOX_PHP="{{ PHP_BIN }}" ` - Path to php binary
33+
34+ _ Path to php used for running composer._
35+
36+ #### ` COMPOSER_SANDBOX_COMPOSER="composer" ` - Path to composer
37+
38+ _ Path to composer binary to use for running the tests._
39+
40+ #### ` COMPOSER_SANDBOX_EXTRA_ARGS="" ` - Extra arguments for composer
41+
42+ _ String that will be appended to every invocation of composer command._
43+
44+ > ** Warning!** Arguments passed through env vars must must be space-delimited
45+ > and each argument cannot contain space characters even if they are escaped.
46+
47+
48+ #### ` COMPOSER_SANDBOX_TEST_DEBUG ` - Enable extra debugging features
49+
50+ If enabled sandbox directories of failed tests are preserved and composer
51+ command output is flushed for every test.
2152
0 commit comments