# Backend Testing Integration

> Integration tests, database testing.

- Skill: `valec3/backend-testing-integration` (Agent Skill)
- Install (CLI): `npx skillmds@latest add valec3/backend-testing-integration`
- Raw SKILL.md: https://api.skillmd.com/api/skills/valec3/backend-testing-integration/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: valec3 (https://skillmd.com/u/valec3)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/valec3/backend-testing-integration

---


# Backend Testing Integration

## When to use this skill
- Testing with database
- API endpoint testing
- Feature testing
- End-to-end flows

## Workflow
- [ ] Use test database
- [ ] Seed data
- [ ] Test full flows
- [ ] Reset database
- [ ] Test API responses

## Instructions

### Database Test
```php
<?php

namespace Tests\Integration;

use CodeIgniter\Test\CIDatabaseTestCase;

class UserModelTest extends CIDatabaseTestCase
{
    protected $seed = 'TestSeeder';
    protected $basePath = 'tests/database';

    public function testFindUserByEmail()
    {
        $model = new UserModel();
        $user = $model->where('email', 'test@example.com')->first();

        $this->assertNotNull($user);
        $this->assertEquals('test@example.com', $user->email);
    }
}
```

### Feature Test
```php
<?php

$result = $this->withHeaders(['Authorization' => 'Bearer ' . $token])
    ->post('/api/users', ['name' => 'John'])
    ->json();

$this->assertEquals(201, $result->getStatusCode());
```

## Resources
- Use separate test database
- Seed fixtures
- Test full request/response

