quality-testing

A guide for checking Drupal code and writing automated tests. Drupal is a PHP system for building websites; the guide covers its tests, coding rules, and analysis tools.

In plain words
What is it for?
Use it to write unit, integration, browser, and other Drupal tests, run PHP code checks, analyze types, refactor code, and set up continuous integration quality checks.
Why use it?
It helps catch defects and style problems before Drupal code is released or merged.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/abderrahimghazali/drupal-boost/quality-testing
Any agent
npx skills add abderrahimghazali/drupal-boost --skill quality-testing
Clone the repo
git clone --depth 1 https://github.com/abderrahimghazali/drupal-boost

Made for: Claude Code, Codex.

Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,097 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00056 $0.01097
Opus 5 $0.00028 $0.00549
Sonnet 5 $0.00011 $0.00219
Haiku 4.5 $0.00006 $0.00110

Measured 2d ago against content hash 337ab4735bf9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

quality-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/quality-testing/SKILL.md · 164 lines

How it starts

The opening of the file, as written. The whole thing — 164 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Drupal Quality & Testing

PHPUnit Test Types

Unit Tests

  • Location: tests/src/Unit/
  • Extend: Drupal\Tests\UnitTestCase
  • No Drupal bootstrap, no database
  • Mock all dependencies with $this->createMock() or Prophecy
namespace Drupal\Tests\MODULE_NAME\Unit;

use Drupal\Tests\UnitTestCase;

class MyServiceTest extends UnitTestCase {

  public function testSomething(): void {
    $mock = $this->createMock(SomeInterface::class);
    $mock->method('getValue')->willReturn('test');
    $service = new MyService($mock);
    $this->assertEquals('expected', $service->process());
  }

}

Kernel Tests

  • Location: tests/src/Kernel/
  • Extend: Drupal\KernelTests\KernelTestBase
  • Minimal bootstrap with database and services
namespace Drupal\Tests\MODULE_NAME\Kernel;

use Drupal\KernelTests\KernelTestBase;

class MyServiceKernelTest extends KernelTestBase {

  protected static $modules = ['system', 'user', 'node', 'MODULE_NAME'];

  protected function setUp(): void {
    parent::setUp();
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installConfig(['system', 'MODULE_NAME']);
  }

  public function testServiceIntegration(): void {
    $service = $this->container->get('MODULE_NAME.my_service');
    $this->assertNotNull($service);
  }

}

Functional Tests

  • Location: tests/src/Functional/
  • Extend: Drupal\Tests\BrowserTestBase
  • Full Drupal install, simulated browser
namespace Drupal\Tests\MODULE_NAME\Functional;

use Drupal\Tests\BrowserTestBase;

class MyPageTest extends BrowserTestBase {

  protected static $modules = ['MODULE_NAME'];
  protected $defaultTheme = 'stark';

  public function testPageAccess(): void {
    $user = $this->drupalCreateUser(['access content']);
    $this->drupalLogin($user);
    $this->drupalGet('/my-page');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->pageTextContains('Expected text');
  }

}

Running Tests

# Single test file
ddev exec ./vendor/bin/phpunit -c web/core web/modules/custom/MODULE/tests/src/Unit/MyTest.php

# By group
ddev exec ./vendor/bin/phpunit -c web/core --group MODULE_NAME

# By test type directory
ddev exec ./vendor/bin/phpunit -c web/core web/modules/custom/MODULE/tests/src/Kernel/

# With filter
ddev exec ./vendor/bin/phpunit -c web/core --filter testMethodName

Read the full file on GitHub · 164 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 164 lines · 56 tokens per session scan A 337ab4735bf9

Subscribe to this mod's changes

quality-testing is a skill published in the GitHub repository abderrahimghazali/drupal-boost (1 stars, last pushed 5mo ago), licensed MIT. It adds 56 tokens to every session and 1,097 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

testing-patterns

Testing patterns and principles. Unit, integration, mocking strategies.

vudovn/ag-kit · 16 tokens

testing

Writing or debugging tests, choosing unit vs integration style, Postgres/ClickHouse tests, regenerating ClickHouse test schema, or exporting test helpers from packages without pulling test code into production bundles.

latitude-dev/latitude-llm · 41 tokens

detect-flaky-tests

Detects flaky Go tests by analyzing GitHub Actions workflow runs across the last 7 days and all PRs — covering both the run-tests job (unit/integration) and the e2e-test job (gVisor and microVM lanes). For each newly-detected flaky test or infra issue, opens a GitHub issue with full evidence and a draft fix PR. Does…

agent-substrate/substrate · 102 tokens

designing-tests

Designs and implements testing strategies for any codebase. Use when adding tests, improving coverage, setting up testing infrastructure, debugging test failures, or when asked about unit tests, integration tests, or E2E testing.

CloudAI-X/claude-workflow-v2 · 48 tokens

test

Run tests. Use after code changes to validate. Arguments: unit (default, no GPU), e2e (with models), filter name, or all.

soniqo/speech-swift · 34 tokens

check-and-test

Run lint checks (ruff for Python, Biome for TS/JS), type checks (pyright for Python, tsc for TS/JS), and the standard pytest tiers (unit + e2e + tests skipped during pre-commit). Investigates failures to determine if they are application bugs or test issues, and fixes application bugs rather than weakening tests. Does…

ReflexioAI/claude-smart · 97 tokens