The /composer directory is not symlinked

Created on 16 June 2025, 28 days ago

Problem/Motivation

Apparently the /composer directory is not symlinked to the /builds directory when builidng the test codebase, and I suspect this is causing this warning with the new test discovery process introduced by 📌 Deprecate TestDiscovery test file scanning, use PHPUnit API instead Active , as seen in 📌 Test with 11.2.0-rc2 Active :

* PHPUnit\Event\Test\PhpunitErrorTriggered: The data provider specified for Drupal\Tests\Composer\Generator\BuilderTest::testBuilder is invalid
Class "Drupal\Composer\Composer" not found
/builds/project/scheduler/web/core/lib/Drupal/Core/Test/PhpUnitTestDiscovery.php:147
/builds/project/scheduler/web/core/scripts/run-tests.sh:1050
/builds/project/scheduler/web/core/scripts/run-tests.sh:189

* PHPUnit\Event\TestRunner\WarningTriggered: No tests found in class "Drupal\Tests\Composer\Generator\BuilderTest".

* PHPUnit\Event\Test\PhpunitErrorTriggered: The data provider specified for Drupal\Tests\ComposerIntegrationTest::testComposerTilde is invalid
The "/builds/project/scheduler/web/composer" directory does not exist.
/builds/project/scheduler/web/core/lib/Drupal/Core/Test/PhpUnitTestDiscovery.php:147
/builds/project/scheduler/web/core/scripts/run-tests.sh:1050
/builds/project/scheduler/web/core/scripts/run-tests.sh:189

Steps to reproduce

Proposed resolution

Add the symlink.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Component

gitlab-ci

Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mondrake
  • 🇬🇧United Kingdom jonathan1055

    Hi Mondrake, thanks for raising this, following up the testing on 📌 Test with 11.2.0-rc2 Active . The Gitlab Templates phpunit jobs are run in the top-level $CI_PROJECT_DIR. So to avoid any confusion, I want to check that you are saying we have a problem in scripts/symlink_project.php. This is where we create symlinks in, for example, /builds/project/scheduler/web/modules/custom/scheduler pointing back to the project's own files files in /builds/project/scheduler

    So your problem/request is that we need make an additional symlink somewhere. Is that we create, for examlpe /builds/project/scheduler/web/composer point to ? where is the source folder?

  • 🇮🇹Italy mondrake 🇮🇹

    I don't know... what I think is that "/builds/project/scheduler/web/composer" is a directory that should be reachable but it apparently isn't. That should be I suppose the /composer directory of Drupal core, that is on the 1st level of directories of the package, like /core, /modules, /themes, /sites etc.

  • 🇪🇸Spain fjgarlin

    Note that projects installed with the "drupal/core-recommended"

    $ composer create-project drupal/recommended-project my_site_name
    ...
    $ cd my_site_name && ls -la web 
    total 104
    drwxr-xr-x@ 19 myuser  mygroup   608B Jun 17 10:58 ./
    drwxr-xr-x@  9 myuser  mygroup   288B Jun 17 10:58 ../
    -rw-r--r--@  1 myuser  mygroup   1.0K Jun 17 10:58 .csslintrc
    -rw-r--r--@  1 myuser  mygroup   151B Jun 17 10:58 .eslintignore
    -rw-r--r--@  1 myuser  mygroup    41B Jun 17 10:58 .eslintrc.json
    -rw-r--r--@  1 myuser  mygroup   2.4K Jun 17 10:58 .ht.router.php
    -rw-r--r--@  1 myuser  mygroup   7.6K Jun 17 10:58 .htaccess
    -rw-r--r--@  1 myuser  mygroup    87B Jun 17 10:58 INSTALL.txt
    -rw-r--r--@  1 myuser  mygroup   3.1K Jun 17 10:58 README.md
    -rw-r--r--@  1 myuser  mygroup   268B Jun 17 10:58 autoload.php
    drwxr-xr-x@ 53 myuser  mygroup   1.7K Jun  6 01:34 core/
    -rw-r--r--@  1 myuser  mygroup   1.5K Jun 17 10:58 example.gitignore
    -rw-r--r--@  1 myuser  mygroup   549B Jun 17 10:58 index.php
    drwxr-xr-x@  3 myuser  mygroup    96B Jun 17 10:58 modules/
    drwxr-xr-x@  3 myuser  mygroup    96B Jun 17 10:58 profiles/
    -rw-r--r--@  1 myuser  mygroup   2.0K Jun 17 10:58 robots.txt
    drwxr-xr-x@  7 myuser  mygroup   224B Jun 17 10:58 sites/
    drwxr-xr-x@  3 myuser  mygroup    96B Jun 17 10:58 themes/
    -rw-r--r--@  1 myuser  mygroup   804B Jun 17 10:58 update.php
    
  • 🇪🇸Spain fjgarlin

    That's not exactly the approach of the templates, but I guess whatever is removing the folder in the above might be removing the folder in our setup.

  • 🇪🇸Spain fjgarlin

    Another try with both "drupal/core" and "drupal/core-recommended":

    $ mkdir test && cd test
    $ composer require drupal/core && ls -l vendor/drupal/core | grep "^d" && composer remove drupal/core
    ...
    drwxr-xr-x@  5 myuser  mygroup   160B Jun  6 01:34 assets/
    drwxr-xr-x@  4 myuser  mygroup   128B Jun  6 01:34 config/
    drwxr-xr-x@ 14 myuser  mygroup   448B Jun  6 01:34 includes/
    drwxr-xr-x@  5 myuser  mygroup   160B Jun  6 01:34 lib/
    drwxr-xr-x@ 59 myuser  mygroup   1.8K Jun  6 01:34 misc/
    drwxr-xr-x@ 76 myuser  mygroup   2.4K Jun  6 01:34 modules/
    drwxr-xr-x@  6 myuser  mygroup   192B Jun  6 01:34 profiles/
    drwxr-xr-x@ 31 myuser  mygroup   992B Jun  6 01:34 recipes/
    drwxr-xr-x@ 15 myuser  mygroup   480B Jun  6 01:34 scripts/
    drwxr-xr-x@  7 myuser  mygroup   224B Jun  6 01:34 tests/
    drwxr-xr-x@  8 myuser  mygroup   256B Jun  6 01:34 themes/
    ...
    $ composer require drupal/core-recommended && ls -l vendor/drupal/core | grep "^d" && composer remove drupal/core-recommended
    ...
    drwxr-xr-x@  5 myuser  mygroup   160B Jun  6 01:34 assets/
    drwxr-xr-x@  4 myuser  mygroup   128B Jun  6 01:34 config/
    drwxr-xr-x@ 14 myuser  mygroup   448B Jun  6 01:34 includes/
    drwxr-xr-x@  5 myuser  mygroup   160B Jun  6 01:34 lib/
    drwxr-xr-x@ 59 myuser  mygroup   1.8K Jun  6 01:34 misc/
    drwxr-xr-x@ 76 myuser  mygroup   2.4K Jun  6 01:34 modules/
    drwxr-xr-x@  6 myuser  mygroup   192B Jun  6 01:34 profiles/
    drwxr-xr-x@ 31 myuser  mygroup   992B Jun  6 01:34 recipes/
    drwxr-xr-x@ 15 myuser  mygroup   480B Jun  6 01:34 scripts/
    drwxr-xr-x@  7 myuser  mygroup   224B Jun  6 01:34 tests/
    drwxr-xr-x@  8 myuser  mygroup   256B Jun  6 01:34 themes/
    ...
    

    So assuming that that folder is going to be there

  • 🇮🇹Italy mondrake 🇮🇹

    Drupal's core composer.json has this

        "autoload": {
            "psr-4": {
                "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer",
                "Drupal\\Composer\\": "composer"
            }
        },
    

    and I suppose this is why we get Class "Drupal\Composer\Composer" not found during test discovery: a core test's dataprovider tries to access it, it fails, then we get the warning above. Looks like an edge case, but I suspect that this unveils a potential bug: if a contrib module would try to access that class, it would fail.

  • 🇬🇧United Kingdom jonathan1055

    When Gitlab Templates is updated to version 1.10.0 which will be soon, then all current PHPUnit jobs will be getting lots of these warnings as shown in the issue summary.

    I have modified the title, to help developers find this issue, and also because symlinking is not necessarily the solution here (so is confusing if in the title)

Production build 0.71.5 2024