<p><a href="/daily/2024/02/07/running-tests-in-parallel-with-paratest">In yesterday's email</a>, I mentioned parallel testing and speeding up your tests by running them in parallel.</p>
<p>Something else I've been experimenting with recently in architectural testing with PHPat.</p>
<p>For example, ensuring classes within a namespace are <code>final</code> or not, that Controller classes all extend <code>ControllerBase</code> and have the Controller suffix in their names.</p>
<p>Going forward, I'd like to ensure that each Drupal module only uses its own classes and is separated, as I recently had an issue where I deleted a class method in one module only to find it was used in a different module.</p>
<p>Here's what I have so far for my <a href="/atdc">testing course codebase</a>:</p>
<pre><code class="language-php">final class ArchitectureTest {
public function test_classes_should_be_final():Rule {
<p>I plan to continue expanding this configuration as I become more familiar with PHPat, and because it's a PHPStan extension, it's already available to run within my projects locally and within the CI pipeline.</p>
<p><a href="/daily/2024/02/07/running-tests-in-parallel-with-paratest">In yesterday's email</a>, I mentioned parallel testing and speeding up your tests by running them in parallel.</p>
<p>Something else I've been experimenting with recently in architectural testing with PHPat.</p>
<p>For example, ensuring classes within a namespace are <code>final</code> or not, that Controller classes all extend <code>ControllerBase</code> and have the Controller suffix in their names.</p>
<p>Going forward, I'd like to ensure that each Drupal module only uses its own classes and is separated, as I recently had an issue where I deleted a class method in one module only to find it was used in a different module.</p>
<p>I plan to continue expanding this configuration as I become more familiar with PHPat, and because it's a PHPStan extension, it's already available to run within my projects locally and within the CI pipeline.</p>