# 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:

```php
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