Skip to content

Conversation

@emreakay
Copy link
Contributor

@emreakay emreakay commented Dec 8, 2025

No description provided.

Emre Akay and others added 10 commits December 6, 2025 17:32
Moved FileHandlerTest and SecurityTest from Unit to Integration
folder to resolve database dependency issues. Integration tests
are expected to require database connections, which are available
both locally and on GitHub CI (MySQL/PostgreSQL containers).

Changes:
- tests/Unit/FileHandlerTest.php → tests/Integration/FileHandlerTest.php
- tests/Unit/SecurityTest.php → tests/Integration/SecurityTest.php
- Removed DB/Schema facade mocking (no longer needed)
- Kept Storage::fake() for filesystem testing

Tests will now work in both environments:
- Locally: with running MySQL/PostgreSQL
- GitHub CI: with service containers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed multiple test issues that appeared after moving unit tests:

1. FlexyFieldTypeEnumTest: Updated enum count from 7 to 8 (added FILE type)
2. FileFieldTest:
   - Fixed test model to implement FlexyModelContract interface
   - Fixed SchemaField type comparison (enum vs string)
3. FileHandlerTest:
   - Fixed path traversal test (sanitizes instead of throwing)
   - Fixed signed URL test (checks for expiration param)
   - Fixed invalid upload test (removed broken reflection approach)
4. SecurityTest:
   - Fixed path traversal test behavior expectations
   - Fixed metadata override test (use .zip instead of .txt)
   - Simplified logging test

All newly moved integration tests now pass:
- FileHandlerTest: 24/24 ✅
- SecurityTest: 20/20 ✅

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed multiple critical issues with file field implementation:

1. **Flexy Trait Fixes**:
   - Changed handleFileUpload visibility from private to protected
   - Fixed $this context issue in static::saving callback
   - Added Illuminate\Support\Str import
   - Update in-memory flexy field after file upload
   - Fixed deleteFlexyFile SchemaField query (use whereHas)
   - Update in-memory field to null after file deletion

2. **Test Database Setup**:
   - FileFieldTest: Added database table creation (MySQL/PostgreSQL/SQLite)
   - FileFieldIntegrationTest: Fixed table name (ff_example_flexy_models)
   - Fixed SQL syntax for different database drivers

3. **Test Fixes**:
   - Fixed ExampleFlexyModel import namespace
   - Fixed signed URL test expectations
   - Fixed null file field validation test (update to nullable)
   - Fixed SchemaField relation name (fieldSchema -> schema)

All tests now passing:
- 346 passed
- 3 skipped
- 852 assertions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@emreakay emreakay merged commit 2e13f26 into main Dec 8, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants