mirror of
https://github.com/flarum/core.git
synced 2025-08-26 09:34:59 +02:00
chore: improve test suite (#3814)
Allows running tests without constantly running `composer install` on each extension.
This commit is contained in:
42
php-packages/testing/bootstrap/monorepo.php
Normal file
42
php-packages/testing/bootstrap/monorepo.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
||||
| This is specific to a monorepo setup. If you're using a single
|
||||
| repository for your extension, checkout the extension skeleton
|
||||
| at https://github.com/flarum/cli/tree/main/boilerplate/skeleton/extension.
|
||||
|
|
||||
| ---------------------------------------------------------------
|
||||
|
|
||||
| We symlink local vendor bins to the framework vendor bin
|
||||
| to be able to run scripts from the extension directory.
|
||||
|
|
||||
| We also use a `FLARUM_TEST_VENDOR_PATH` environment variable
|
||||
| to tell each extension where to find the framework vendor,
|
||||
| instead of a SetupScript property, because it is also needed
|
||||
| when running the tests.
|
||||
|
|
||||
*/
|
||||
|
||||
$monorepoVendor = __DIR__.'/../../../vendor';
|
||||
|
||||
// The root directory of the extension where tests are run from.
|
||||
$localVendor = getcwd().'/vendor';
|
||||
|
||||
if (! file_exists("$localVendor/bin")) {
|
||||
mkdir("$localVendor");
|
||||
symlink("$monorepoVendor/bin", "$localVendor/bin");
|
||||
}
|
||||
|
||||
require $monorepoVendor.'/autoload.php';
|
||||
|
||||
putenv('FLARUM_TEST_VENDOR_PATH='.$monorepoVendor);
|
||||
|
||||
return new Flarum\Testing\integration\Setup\SetupScript();
|
Reference in New Issue
Block a user