Make it easier to run PHPUnit tests: enable `composer run phpunit` from Canvas root
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3585788. --> Reported by: [wim leers](https://www.drupal.org/user/99777) Related to !941 >>> <h3 id="overview">Overview</h3> <p>We previously simplified running PHPCS and PHPStan by including <code>composer run phpstan</code> etc.</p> <p>Running the Canvas PHPUnit test suite can be somewhat daunting. Doubly so because upstream deprecations can litter</p> <p><em>(I personally have been shielded from it thanks to PHPStorm's excellent UX for this &mdash; which in turn generates a pretty arcane command.)</em></p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Do the same for PHPUnit: <code>composer run phpunit</code>.</p> <p>This enables running the entire Canvas PHPUnit test suite, or just a single test or a single method, without the directory changing shenanigans.</p> <p>It would make the instructions simple for both human contributors and LLMs.</p> <ol> <li>Misconfigured PHPUnit <a href="https://git.drupalcode.org/project/canvas/-/merge_requests/941#note_752688">provides helpful guidance</a> </li><li><a href="https://git.drupalcode.org/-/project/19391/uploads/e1e50a2364652cbbd1c76ab8741cb0d3/Screenshot_2026-04-20_at_4.23.25_PM.png">Screenshot of <code>composer run phpunit help</code> output</a></li> <li>All of those examples <em>do</em> work, <a href="https://git.drupalcode.org/-/project/19391/uploads/898ff4dd2da73af2c02585a73131ff2f/Screenshot_2026-04-20_at_4.24.33_PM.png">for example the "filter by method" one</a>. <p>Relevant docs: <a href="https://getcomposer.org/doc/articles/scripts.md">https://getcomposer.org/doc/articles/scripts.md</a></p> <h3 id="ui-changes">User interface changes</h3> <p>None.</p> </li></ol>
issue