\MockDataObject
Injects functionality into every {@link DataObject} subclass to populate its database fields and data relations with mock data.
- Author: Uncle Cheese <unclecheese@leftandmain.com>
Synopsis
class MockDataObject
extends DataExtension
{
- // members
- protected MockViewableData $fakeInstance;
- private static array $mock_blacklist = ;
- // methods
- public static DataList get_mock_files()
- public static Folder get_mock_folder()
- public static void install_mock_files()
- public static Image download_lorem_image()
- public static File get_random_local_image()
- public MockViewableData Fake()
- public DataObject fill()
- public void onBeforeDelete()
Hierarchy
Extends
- DataExtension
Tasks
Line | Task |
---|---|
74+ | This should really be an injectable service. It locks the user into a specific URL. |
Members
private
- $mock_blacklist
protected
- $fakeInstance
—
MockViewableData
Stores an instance of a {@link MockViewableData} object
Methods
public
- Fake() — Template accessor for {@link MockViewableData}
- download_lorem_image() — Downloads a random image from a public website and installs it into the filesystem
- fill() — Populates all of the native database fields and optionally fills in data relations.
- get_mock_files() — An accessor to get all of the stock files that ship with the package
- get_mock_folder() — An accessor to get the folder where all of the stock files are stored
- get_random_local_image() — Gets a random image that already exists in the filesystem
- install_mock_files() — Copies stock files from the module directory to the filesytem and updates the database.
- onBeforeDelete() — Cleans up the {@link MockDataLog} records. This is kind of expensive to attach to every DataObject for every delete, but fortunately this module is never used in production.