class RealisticDummyContentLiveEnvironment in Realistic Dummy Content 3.x
Same name and namespace in other branches
- 8.2 api/src/includes/RealisticDummyContentLiveEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentLiveEnvironment
- 7.2 api/src/includes/RealisticDummyContentLiveEnvironment.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentLiveEnvironment
The live environment.
During normal execution, we want to do things like interact with the file- system and such. However during testing we want to abstract that away. This class represents the live environment.
Hierarchy
- class \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentEnvironment
- class \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentLiveEnvironment
Expanded class hierarchy of RealisticDummyContentLiveEnvironment
File
- api/
src/ includes/ RealisticDummyContentLiveEnvironment.php, line 12
Namespace
Drupal\realistic_dummy_content_api\includesView source
class RealisticDummyContentLiveEnvironment extends RealisticDummyContentEnvironment {
/**
* {@inheritdoc}
*/
public function implementFileGetContents($filename) : string {
$return = file_get_contents($filename);
if ($return === FALSE) {
throw new \Exception('Cannot get contents of ' . $filename);
}
return $return;
}
/**
* {@inheritdoc}
*/
public function implementFileSaveData($data, $destination = NULL) {
return file_save_data($data, $destination);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RealisticDummyContentEnvironment:: |
private static | property | Private variable containing the environment to use. | |
RealisticDummyContentEnvironment:: |
public static | function | Adds a file to an array of file group parts. | |
RealisticDummyContentEnvironment:: |
public static | function | Returns the attribute of a filename if one exists. | |
RealisticDummyContentEnvironment:: |
public | function | Get the contents of a file. | |
RealisticDummyContentEnvironment:: |
public static | function | Returns the name radical of a filename. | |
RealisticDummyContentEnvironment:: |
public | function | Save the file data to the real or test environment. | |
RealisticDummyContentEnvironment:: |
public static | function | Get the current environment. | |
RealisticDummyContentEnvironment:: |
public static | function | Returns all files with a given extension for a given filepath. | |
RealisticDummyContentEnvironment:: |
public static | function | Returns the trimmed contents of a Drpual file object, or NULL if empty. | |
RealisticDummyContentEnvironment:: |
public static | function | Retrieves the parts constituting a filename. | |
RealisticDummyContentEnvironment:: |
public static | function | Given a list of candidate files, sort them by names and parts. | |
RealisticDummyContentEnvironment:: |
public static | function | Returns the part of a string before the extension, in lowercase. | |
RealisticDummyContentEnvironment:: |
public static | function | Returns part of a filename. | |
RealisticDummyContentEnvironment:: |
public static | function | Set the current environment. | |
RealisticDummyContentEnvironment:: |
public static | function | Given a list of candidate files, sort them by names and parts. | |
RealisticDummyContentEnvironment:: |
public static | function | Wrapper around drupal_strtolower(if it exists) or strtolower. | |
RealisticDummyContentEnvironment:: |
public static | function | Checks if a filename is valid. | |
RealisticDummyContentLiveEnvironment:: |
public | function |
Internal function used to get the contents of a file. Overrides RealisticDummyContentEnvironment:: |
|
RealisticDummyContentLiveEnvironment:: |
public | function |
Implements $this->fileSaveData(). Overrides RealisticDummyContentEnvironment:: |