Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1.39 KB

File metadata and controls

39 lines (28 loc) · 1.39 KB

detain/myadmin-contracts

Shared MyAdmin\App\Contracts\* interfaces for the MyAdmin billing/management platform, extracted from the core interserver/my repo so that the core and every detain/myadmin-* module can depend on a single source of truth — and unit-test against these contracts with fakes without pulling in the whole core.

Interfaces

Interface Purpose
AccountsInterface Accounts abstraction (read/add/update/delete/cross_reference/exists/get_next_id).
DatabaseInterface Abstraction over MyDb\Generic / MyDb\Mysqli\Db (query/next_record/num_rows/real_escape/getLastInsertId/qr/f).
RequestContextInterface Per-request user/view state (ima/accountId/locale/language/theme/isAdmin).
SessionInterface Session abstraction (verify/create/destroy/appsession/CSRF helpers).

Namespace-preserving: the interfaces keep their original MyAdmin\App\Contracts\ namespace, so moving them out of core requires no changes to the ~23 core consumers or to any module.

Install

composer require detain/myadmin-contracts

Writing fakes in a module's tests

use MyAdmin\App\Contracts\DatabaseInterface;

final class FakeDb implements DatabaseInterface
{
    // ... implement the interface, return canned rows ...
}

License

LGPL-2.1-only.