MMOframework
Why AI Playground Libraries Documentation Search Agency
FR EN
Index

TestDataStore

MMO\admin\helpers · 1 symbol · generated 27 Oct 2026

class

TestDataStore

TestDataStore.php:15

Where TestData reads and makes the test records: an application's repository, through its entities -- each record committed as the account writing it (\MMO\oauth\user() while it is saved), so the application's rules apply as to that account's request; a file as mmo.edms' FileManager::uploadFile() does (upload).

class MMO\admin\helpers\TestDataStore
Namespace
MMO\admin\helpers
$store = new TestDataStore(\MMO\getInstance('repository'));

Index

filesKey
repository
archive($entity, $author)Archive $entity, as $author
author($username)
commitAs($author, $entity, $change)Change $entity with $change, and commit it as $author.
create($collection, $data, $status, $calls, $author)Make a record, as $author: its fields, its add…() calls, its status; committed alone.
find($collection, $where, $sort)
get($collection, $id)
hasProperty($entity, $name)
id($entity)
isArchived($entity)
labelled($collection, $label)
setUser($user)
upload($author, $name, $content, $labels, $data)Make a file of $author (mmo.edms), from $content: its labels' tokens, its fields (attachment, description) -- as FileManager::uploadFile() does, its bytes under $filesKey (the storage's …
user()
value($from, $path)
__construct($repository)

Properties2

filesKey

string $filesKey = 'test-data'
Type
string

repository

protected MMO\core\interfaces\iRepository $repository
Type
iRepository

Methods15

commitAs($author, $entity, $change)

TestDataStore.php:133

Change $entity with $change, and commit it as $author.

protected function commitAs(?object $author, object $entity, callable $change): object
$authornull | object
$entityobject
$changecallable
returnsobject$entity
throwswhat the application refuses it with

create($collection, $data, $status, $calls, $author)

TestDataStore.php:69

Make a record, as $author: its fields, its add…() calls, its status; committed alone.

function create( string $collection, array $data, ?string $status, array $calls, object $author ): object
$collectionstring
$dataarray
$statusnull | string
$callsarray
$authorobject
returnsobjectthe record saved
throwswhat the application refuses it with: nothing is left of it

find($collection, $where, $sort)

TestDataStore.php:42
function find(string $collection, array $where, array $sort = []): ?object
$collectionstring
$wherearray
$sort = []array
returnsnull | objectthe first record of $collection $where finds ($sort: {field: 1|-1})

hasProperty($entity, $name)

TestDataStore.php:147
protected function hasProperty(object $entity, string $name): bool
$entityobject
$namestring
returnsboolwhether $entity declares the property $name

labelled($collection, $label)

TestDataStore.php:31
function labelled(string $collection, string $label): ?object
$collectionstring
$labelstring
returnsnull | objecta record of $collection whose label (or title) is $label, not archived (an archived one is no longer in the way)

upload($author, $name, $content, $labels, $data)

TestDataStore.php:90

Make a file of $author (mmo.edms), from $content: its labels' tokens, its fields (attachment, description) -- as FileManager::uploadFile() does, its bytes under $filesKey (the storage's month folders are the web server's: this machine's user may not write in them, and one it made the web server could not), readable by the web server.

function upload( object $author, string $name, string $content, array $labels, array $data ): object
$authorobject
$namestring
$contentstring
$labelsarray
$dataarray
returnsobjectthe file saved

__construct($repository)

TestDataStore.php:17
function __construct(MMO\core\interfaces\iRepository $repository)
$repositoryiRepositorythe application's (\MMO\getInstance('repository')): its collections by id