[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/cache/tests/fixtures/ -> lib.php (summary)

Support library for the cache PHPUnit tests. This file is part of Moodle's cache API, affectionately called MUC. It contains the components that are requried in order to use caching.

Copyright: 2012 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 540 lines (18 kb)
Included or required:0 times
Referenced: 5 times
Includes or requires: 0 files

Defines 9 classes

cache_config_testing:: (9 methods):
  create_default_configuration()
  get_config_file_path()
  phpunit_add_definition()
  phpunit_remove_definition()
  phpunit_remove_stores()
  phpunit_add_file_store()
  phpunit_add_session_store()
  phpunit_add_definition_mapping()
  get_site_identifier()

cache_config_phpunittest:: (0 methods):

cache_phpunit_dummy_object:: (3 methods):
  __construct()
  prepare_to_cache()
  wake_from_cache()

cache_phpunit_dummy_datasource:: (3 methods):
  get_instance_for_cache()
  load_for_cache()
  load_many_for_cache()

cache_phpunit_application:: (3 methods):
  phpunit_get_store_class()
  phpunit_get_store_implements()
  phpunit_static_acceleration_get()

cache_phpunit_session:: (2 methods):
  phpunit_get_store_class()
  phpunit_get_store_implements()

cache_phpunit_request:: (2 methods):
  phpunit_get_store_class()
  phpunit_get_store_implements()

cache_phpunit_dummy_overrideclass:: (0 methods):

cache_phpunit_factory:: (2 methods):
  phpunit_disable()
  create_store_from_config()


Class: cache_config_testing  - X-Ref

Override the default cache configuration for our own maniacal purposes.

This class was originally named cache_config_phpunittest but was renamed in 2.9
because it is used for both unit tests and acceptance tests.

create_default_configuration($forcesave = false)   X-Ref
Creates the default configuration and saves it.

This function calls config_save, however it is safe to continue using it afterwards as this function should only ever
be called when there is no configuration file already.

param: bool $forcesave If set to true then we will forcefully save the default configuration file.
return: true|array Returns true if the default configuration was successfully created.

get_config_file_path()   X-Ref
Returns the expected path to the configuration file.

We override this function to add handling for $CFG->altcacheconfigpath.
We want to support it so that people can run unit tests against alternative cache setups.
However we don't want to ever make changes to the file at $CFG->altcacheconfigpath so we
always use dataroot and copy the alt file there as required.

return: string The absolute path

phpunit_add_definition($area, array $properties, $addmapping = true)   X-Ref
Adds a definition to the stack

param: string $area
param: array $properties
param: bool $addmapping By default this method adds a definition and a mapping for that definition. You can

phpunit_remove_definition($name)   X-Ref
Removes a definition.

param: string $name

phpunit_remove_stores()   X-Ref
Removes the configured stores so that there are none available.


phpunit_add_file_store($name)   X-Ref
Forcefully adds a file store.

param: string $name

phpunit_add_session_store($name)   X-Ref
Forcefully adds a session store.

param: string $name

phpunit_add_definition_mapping($definition, $store, $sort)   X-Ref
Forcefully injects a definition => store mapping.

This function does no validation, you should only be calling if it you know
exactly what to expect.

param: string $definition
param: string $store
param: int $sort

get_site_identifier()   X-Ref
Overrides the default site identifier used by the Cache API so that we can be sure of what it is.

return: string

Class: cache_config_phpunittest  - X-Ref

This is a deprecated class. It has been renamed to cache_config_testing.

This was deprecated in Moodle 2.9 but will be removed at the next major release
as it is only used during testing and its highly unlikely anyone has used this.

Class: cache_phpunit_dummy_object  - X-Ref

Dummy object for testing cacheable object interface and interaction

__construct($property1, $property2)   X-Ref
Constructor

param: string $property1
param: string $property2

prepare_to_cache()   X-Ref
Prepares this object for caching

return: array

wake_from_cache($data)   X-Ref
Returns this object from the cache

param: array $data
return: cache_phpunit_dummy_object

Class: cache_phpunit_dummy_datasource  - X-Ref

Dummy data source object for testing data source interface and implementation

get_instance_for_cache(cache_definition $definition)   X-Ref
Returns an instance of this object for use with the cache.

param: cache_definition $definition
return: cache_phpunit_dummy_datasource

load_for_cache($key)   X-Ref
Loads a key for the cache.

param: string $key
return: string

load_many_for_cache(array $keys)   X-Ref
Loads many keys for the cache

param: array $keys
return: array

Class: cache_phpunit_application  - X-Ref

PHPUnit application cache loader.

Used to expose things we could not otherwise see within an application cache.

phpunit_get_store_class()   X-Ref
Returns the class of the store immediately associated with this cache.

return: string

phpunit_get_store_implements()   X-Ref
Returns all the interfaces the cache store implements.

return: array

phpunit_static_acceleration_get($key)   X-Ref
Returns the given key directly from the static acceleration array.

param: string $key
return: false|mixed

Class: cache_phpunit_session  - X-Ref

PHPUnit session cache loader.

Used to expose things we could not otherwise see within an session cache.

phpunit_get_store_class()   X-Ref
Returns the class of the store immediately associated with this cache.

return: string

phpunit_get_store_implements()   X-Ref
Returns all the interfaces the cache store implements.

return: array

Class: cache_phpunit_request  - X-Ref

PHPUnit request cache loader.

Used to expose things we could not otherwise see within an request cache.

phpunit_get_store_class()   X-Ref
Returns the class of the store immediately associated with this cache.

return: string

phpunit_get_store_implements()   X-Ref
Returns all the interfaces the cache store implements.

return: array

Class: cache_phpunit_dummy_overrideclass  - X-Ref

Dummy overridden cache loader class that we can use to test overriding loader functionality.

Class: cache_phpunit_factory  - X-Ref

Cache PHPUnit specific factory.

phpunit_disable()   X-Ref
Exposes the cache_factory's disable method.

Perhaps one day that method will be made public, for the time being it is protected.

create_store_from_config($name, array $details, cache_definition $definition)   X-Ref
Creates a store instance given its name and configuration.

If the store has already been instantiated then the original object will be returned. (reused)

param: string $name The name of the store (must be unique remember)
param: array $details
param: cache_definition $definition The definition to instantiate it for.
return: boolean|cache_store



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1