Add a base class for kernel tests to improve DX: `CanvasKernelTestBase`
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3563216. --> Reported by: [phenaproxima](https://www.drupal.org/user/205645) Related to !555 >>> <h3 id="overview">Overview</h3> <p>Canvas leans heavily on kernel tests. That's fine - they're speedy! But they are very verbose, and very complex. That makes them hard to understand. We need to start simplifying them, whilst keeping the same robust level of test coverage.</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>A good first step would be to create a new base test class <code>CanvasKernelTestBase</code>, which:</p> <ul> <li>&#9989; Installs all Canvas dependencies (and their dependencies)</li> <li><del>Installs necessary entity schemas</del> &rarr; this would slow down the test suite: <a href="https://git.drupalcode.org/project/canvas/-/merge_requests/555#note_674401">https://git.drupalcode.org/project/canvas/-/merge_requests/555#note_674401</a></li> <li>&#9989; Activates strict config schema checking by default, since Canvas makes extremely extensive use of validation</li> <li><del>Imports core traits for creating specific entities or fields</del> &larr; most Canvas kernel tests don't need this; require those that do need it to do this themselves.</li> </ul> <p>&#9989; We should also change as many Canvas tests as possible to use this base class.</p> <p>Out-of-scope:</p> <ol> <li><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3531679" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3531679</a></span></li> <li><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/canvas/issues/3572401" title="Status: Closed (fixed)">#3572401: PHPCS: require CanvasKernelTestBase to be extended, forbid extending KernelTestBase</a></span></li> </ol> <h3 id="ui-changes">User interface changes</h3> <p>None.</p>
issue