mirror of
https://github.com/friendica/friendica
synced 2025-04-28 21:44:22 +02:00
Make Storage testable & add tests
- Making StorageManager dynamic (DI::facStorage()) - Making concrete Storage dynamic (DI::storage()) - Add tests for Storage backend and failure handling - Bumping Level-2/Dice to "dev-master" until new release - Using Storage-Names instead of Storage-Classes in config (includes migration)
This commit is contained in:
parent
a5895f8623
commit
08edeae2f9
18 changed files with 744 additions and 242 deletions
|
@ -13,26 +13,32 @@ interface IStorage
|
|||
{
|
||||
/**
|
||||
* @brief Get data from backend
|
||||
* @param string $ref Data reference
|
||||
*
|
||||
* @param string $reference Data reference
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get($ref);
|
||||
*/
|
||||
public function get(string $reference);
|
||||
|
||||
/**
|
||||
* @brief Put data in backend as $ref. If $ref is not defined a new reference is created.
|
||||
* @param string $data Data to save
|
||||
* @param string $ref Data referece. Optional.
|
||||
* @return string Saved data referece
|
||||
*
|
||||
* @param string $data Data to save
|
||||
* @param string $reference Data reference. Optional.
|
||||
*
|
||||
* @return string Saved data reference
|
||||
*/
|
||||
public static function put($data, $ref = "");
|
||||
public function put(string $data, string $reference = "");
|
||||
|
||||
/**
|
||||
* @brief Remove data from backend
|
||||
* @param string $ref Data referece
|
||||
*
|
||||
* @param string $reference Data reference
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public static function delete($ref);
|
||||
|
||||
public function delete(string $reference);
|
||||
|
||||
/**
|
||||
* @brief Get info about storage options
|
||||
*
|
||||
|
@ -71,19 +77,23 @@ interface IStorage
|
|||
*
|
||||
* See https://github.com/friendica/friendica/wiki/Quick-Template-Guide
|
||||
*/
|
||||
public static function getOptions();
|
||||
|
||||
public function getOptions();
|
||||
|
||||
/**
|
||||
* @brief Validate and save options
|
||||
*
|
||||
* @param array $data Array [optionname => value] to be saved
|
||||
* @param array $data Array [optionname => value] to be saved
|
||||
*
|
||||
* @return array Validation errors: [optionname => error message]
|
||||
*
|
||||
* Return array must be empty if no error.
|
||||
*/
|
||||
public static function saveOptions($data);
|
||||
|
||||
public function saveOptions(array $data);
|
||||
|
||||
/**
|
||||
* The name of the backend
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue