# Issue #206: Missing Unit Tests for Core Services

## Problem

The codebase has PHP unit tests (`tests/` directory) but the core services lack comprehensive test coverage. Key untested areas:

- `MemberService::create()` - no tests for validation, duplicate detection
- `MemberService::update()` - no tests for field filtering, partial updates
- `MemberService::softDelete()` - no tests for data purge behavior
- `MemberService::findFiltered()` - no tests for filter combinations
- `FeeCalculationService` - mentioned in docs but tests may be incomplete
- `AuditService` - no tests for field masking, diff computation

## Impact

- Risk of regressions when modifying services
- Harder to refactor with confidence
- Potential security issues (e.g., audit log masking) undetected

## Solution

Add comprehensive unit tests using PHPUnit:

```php
class MemberServiceTest extends\TestCase {
    
    /** @var MemberService */
    private $service;
    
    protected function setUp(): void {
        // Mock mappers and services
    }
    
    public function testCreateValidatesRequiredFields(): void {
        $this->expectException(ValidationException::class);
        $this->service->create([]);
    }
    
    public function testCreateDetectsDuplicates(): void {
        $this->expectException(DuplicateMemberException::class);
        $this->service->create([...]);
    }
    
    // ... more tests
}
```

## Tasks

- [ ] Set up PHPUnit with mocks for mappers and services
- [ ] Test `MemberService::create()` - required fields, dates, duplicates
- [ ] Test `MemberService::update()` - editable fields filter, partial updates
- [ ] Test `MemberService::softDelete()` - data purge verification
- [ ] Test `MemberService::findFiltered()` - all filter combinations
- [ ] Test `AuditService::maskIfEncrypted()` - field masking
- [ ] Test `FeeCalculationService::calculateAnnualFee()`
- [ ] Achieve >70% code coverage

## Labels

- enhancement
- testing
- backend
- priority:high