smithery/valec3

backend-testing-phpunit

Unit testing, test structure, mocking.

Installation

$ npx skills add smithery/valec3 --skill backend-testing-phpunit

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/valec3 · top by installs.

npx skills add smithery/valec3

Browse all from smithery/valec3

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,283 B
  • docs SUMMARY.md 69 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Backend Testing PHPUnit

When to use this skill

  • Writing tests
  • TDD development
  • CI/CD pipelines
  • Code quality

Workflow

  • Write tests for critical logic
  • Test edge cases
  • Mock dependencies
  • Run before commits
  • Maintain tests

Instructions

Test Class

<?php

namespace Tests\Unit;

use CodeIgniter\Test\CIUnitTestCase;

class UserServiceTest extends CIUnitTestCase
{
    protected $service;

    protected function setUp(): void
    {
        parent::setUp();
        $this->service = new UserService();
    }

    public function testCreateUserWithValidData()
    {
        $data = ['name' => 'John', 'email' => '[email protected]'];
        $user = $this->service->createUser($data);

        $this->assertInstanceOf(User::class, $user);
        $this->assertEquals('John', $user->name);
    }

    public function testCreateUserThrowsExceptionWithInvalidEmail()
    {
        $this->expectException(ValidationException::class);
        $this->service->createUser(['email' => 'invalid']);
    }
}

Run Tests

vendor/bin/phpunit

Resources

  • Test business logic
  • Mock external dependencies
  • Use descriptive test names