PHPCS: require CanvasKernelTestBase to be extended, forbid extending KernelTestBase
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3572401. -->
Reported by: [wim leers](https://www.drupal.org/user/99777)
Related to !564
>>>
<h3 id="overview">Overview</h3>
<p><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3563216" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3563216</a></span> addressed a Canvas DX pain point we've been struggling with for the past ~year.</p>
<p>To ensure</p>
<ol>
<li>we don't need humans to keep repeating best practices in MR reviews (they're now encoded into the new kernel test base class)</li>
<li>we don't regress against what #3563216 did</li>
</ol>
<p>we should add a PHPCS rule.</p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<p>Add PHPCS rule that requires the use of <code>CanvasKernelTestBase</code> in <code>tests/src/Kernel/**</code><br>
But exempt a few specific files from it: <code>ModuleInstallationTest</code>, <code>RecipeSubscriberTest</code> and every test that <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> will have to update.</p>
<h3 id="ui-changes">User interface changes</h3>
<p>None.</p>
issue