Moodle  2.2.1
http://www.collinsharper.com
UnitTestDB Class Reference

Public Member Functions

 __call ($method, $args)
 __get ($variable)
 __set ($variable, $value)
 __isset ($variable)
 __unset ($variable)
 insert_record ($table, $dataobject, $returnid=true, $bulk=false)
 update_record ($table, $dataobject, $bulk=false)
 delete_records ($table, array $conditions=array())
 delete_records_select ($table, $select, array $params=null)
 cleanup ()
 get_field ($table, $return, array $conditions)

Static Public Member Functions

static instantiate ()
static restore ()

Data Fields

 $table_data = array()

Static Public Attributes

static $DB

Detailed Description

Definition at line 1188 of file simpletestlib.php.


Member Function Documentation

__call ( method,
args 
)

Definition at line 1219 of file simpletestlib.php.

__get ( variable)

Definition at line 1228 of file simpletestlib.php.

__isset ( variable)

Definition at line 1236 of file simpletestlib.php.

__set ( variable,
value 
)

Definition at line 1232 of file simpletestlib.php.

__unset ( variable)

Definition at line 1240 of file simpletestlib.php.

cleanup ( )

Removes from the test DB all the records that were inserted during unit tests,

Definition at line 1348 of file simpletestlib.php.

delete_records ( table,
array conditions = array() 
)

Overriding delete_record: If we are deleting a record that was NOT inserted by unit tests, throw an exception and cancel delete.

throws moodle_exception If trying to delete a record not inserted by unit tests.

Definition at line 1279 of file simpletestlib.php.

delete_records_select ( table,
select,
array params = null 
)

Overriding delete_records_select: If we are deleting a record that was NOT inserted by unit tests, throw an exception and cancel delete.

throws moodle_exception If trying to delete a record not inserted by unit tests.

Definition at line 1318 of file simpletestlib.php.

get_field ( table,
return,
array conditions 
)

Definition at line 1365 of file simpletestlib.php.

insert_record ( table,
dataobject,
returnid = true,
bulk = false 
)

Overriding insert_record to keep track of the ids inserted during unit tests, so that they can be deleted afterwards

Definition at line 1247 of file simpletestlib.php.

static instantiate ( ) [static]

Call this statically to connect to the DB using the unittest prefix, instantiate the unit test db, store it as a member variable, instantiate $this and use it as the new global $DB.

Definition at line 1198 of file simpletestlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static restore ( ) [static]

Restores the global $DB object.

Definition at line 1360 of file simpletestlib.php.

Here is the caller graph for this function:

update_record ( table,
dataobject,
bulk = false 
)

Overriding update_record: If we are updating a record that was NOT inserted by unit tests, throw an exception and cancel update.

throws moodle_exception If trying to update a record not inserted by unit tests.

Definition at line 1260 of file simpletestlib.php.


Field Documentation

$DB [static]

Definition at line 1189 of file simpletestlib.php.

$table_data = array()

Definition at line 1192 of file simpletestlib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations