Files
Mitgliederverwaltung/.plans/open/issue-216-missing-integration-tests.md
T
shahondin1624 b29a268b1d Restructure .plans/ into done/ and open/ subdirectories
- Move completed plan files to .plans/done/
- Move 18 open plan files to .plans/open/
- Update .gitignore to exclude .verified_plans temp file
- Verified all 18 open plans still describe unimplemented issues
2026-04-28 20:30:55 +02:00

2.2 KiB

Issue #216: Missing Integration Tests

Problem

While unit tests exist for some services, there are no integration tests that verify the full request-response cycle:

  • No tests for API endpoint behavior
  • No tests for database operations end-to-end
  • No tests for authentication/authorization flow
  • No tests for concurrent access patterns
  • No tests for data migration scripts

Impact

  • Unknown behavior of API contracts
  • Risk of breaking changes going undetected
  • Difficult to verify authorization works correctly
  • Risk of migration failures in production

Solution

Add integration tests using Nextcloud's testing infrastructure:

class MemberApiIntegrationTest extends \PHPUnit\Framework\TestCase {
    
    use Helper\EmptyContainerTrait;
    
    private ?AppFrameworkApp $app = null;
    private ?MemberController $controller = null;
    
    protected function setUp(): void {
        $this->app = $this->container->get('app');
        $this->controller = $this->app->getContainer()
            ->get(MemberController::class);
    }
    
    public function testCreateMemberRequiresAuthentication(): void {
        $this->expectException(UnauthorizedException::class);
        $this->controller->create();
    }
    
    public function testCreateMemberValidatesRequiredFields(): void {
        $this->givenAuthenticatedUser('admin');
        $response = $this->controller->create([]);
        $this->assertEquals(400, $response->getStatusCode());
    }
    
    public function testSoftDeletePurgesSensitiveData(): void {
        $member = $this->givenMemberWithAllergies();
        $this->controller->destroy($member->id);
        
        $deleted = $this->memberMapper->findById($member->id);
        $this->assertNull($deleted->getAllergienEncrypted());
    }
}

Tasks

  • Set up Nextcloud integration test environment
  • Add integration tests for MemberController CRUD
  • Add integration tests for authorization (admin vs. user)
  • Add integration tests for FamilyController
  • Add integration tests for FeeController
  • Add integration tests for migration scripts
  • Set up CI pipeline for integration tests

Labels

  • enhancement
  • testing
  • backend
  • priority:high