Skip to content

Latest commit

 

History

History
125 lines (93 loc) · 2.82 KB

File metadata and controls

125 lines (93 loc) · 2.82 KB

Phase 2 — Fake MySQL & DBAL Adapter

Version: 1.1.0
Completed: 2025-11-22
Project: maatify/data-fakes


🎯 Goals

  • Implement FakeMySQLAdapter using FakeStorageLayer
  • Implement FakeMySQLDbalAdapter with Doctrine-style API
  • Support full CRUD operations (SELECT, INSERT, UPDATE, DELETE)
  • Support filters, ordering, limit, offset
  • Fully implement AdapterInterface lifecycle:
    • connect()
    • disconnect()
    • isConnected()
    • healthCheck()
    • getConnection()
    • getDriver()
  • DBAL lifecycle fully delegates to FakeMySQLAdapter
  • Integrate and validate traits:
    • NormalizesInputTrait
    • QueryFilterTrait
  • Update FakeStorageLayer to support:
    • deterministic writes
    • auto-increment tracking
    • writeTable() replacement
    • full reset() consistency
  • Add complete PHPUnit coverage for:
    • MySQL adapter
    • DBAL adapter
    • Storage layer behavior

📁 Deliverables

Adapters


src/Adapters/MySQL/FakeMySQLAdapter.php
src/Adapters/MySQL/FakeMySQLDbalAdapter.php

Traits


src/Adapters/Base/Traits/NormalizesInputTrait.php
src/Adapters/Base/Traits/QueryFilterTrait.php

Updated Core Storage


src/Storage/FakeStorageLayer.php

Tests


tests/Adapters/FakeMySQLAdapterTest.php
tests/Adapters/FakeMySQLDbalAdapterTest.php
tests/Storage/FakeStorageLayerTest.php


🧪 Tests Summary

Test Area Status
CRUD operations ✅ Passed
Filters (IN / Contains / Regex) ✅ Passed
Ordering ASC/DESC ✅ Passed
LIMIT / OFFSET ✅ Passed
DBAL wrapper ✅ Passed
AdapterInterface lifecycle ✅ Passed
FakeStorageLayer consistency ✅ Passed

Coverage: 92%
phpstan: Level 6 — Clean


🧩 Reflection Summary

New Classes (Phase 2)

  • FakeMySQLAdapter
  • FakeMySQLDbalAdapter

Updated Classes (from Phase 1)

  • FakeStorageLayer

Traits Used

  • NormalizesInputTrait
  • QueryFilterTrait

Key Methods

  • connect(), disconnect(), isConnected(), healthCheck(), getConnection(), getDriver()
  • select(), insert(), update(), delete()
  • fetchAll(), fetchOne()
  • write(), writeTable(), read(), reset(), drop()


👤 Author

© 2025 Maatify.dev
Engineered by Mohamed Abdulalim (@megyptm)https://www.maatify.dev

📘 Full documentation & source code:
https://github.com/Maatify/data-fakes

🤝 Contributors

Special thanks to the Maatify.dev engineering team and open-source contributors.


Built with ❤️ by Maatify.dev — Unified Ecosystem for Modern PHP Libraries