FUEL CMS User Guide : Version 1.5.2


Tester Base Class

Properties Reference

Property Default Value Description
protected
CI N/A A reference to the CodeIgntier super object
fuel N/A A reference to the FUEL object
loaded_page N/A Determines if a pges is loaded

Function Reference [+]

$this->tester_base->run('$test', '$expected', ['$name'=''], ['$notes'=''], ['$format'=NULL])

Runs a test passing the value and the expected results. The name parameter will help identify it in the results page.

Returns

string

Parameters

(mixed) $test 
(mixed) $expected 
(string) $name 

$this->tester_base->is_cli()

Returns whether the test is being run via Command Line Interface or not.

Returns

boolean

$this->tester_base->setup()

Placeholder to be overwritten by child classes for test setup (like database table creation etc).

Returns

void

$this->tester_base->tear_down()

Is called at the end of the test and will remove any test database that has been created.

Returns

void

$this->tester_base->config_item('$key')

Return Tester specific configuration items.

Returns

mixed

Parameters

(string) $key 

$this->tester_base->db_connect(['$dsn'=''])

Connects to the testing database.

Returns

void

Parameters

(string) $dsn 

$this->tester_base->db_exists()

Checks to see if the database specified in the tester configuration exists or not.

Returns

void

$this->tester_base->create_db()

Creates the database based on the tester configuration values.

Returns

void

$this->tester_base->remove_db()

Removes the test database.

Returns

void

$this->tester_base->load_sql(['$file'=NULL], ['$module'=''])

Loads the sql from a file in the {module}/test/sql folder. You can enter NULL or an empty string '' if you are loading an SQL file from your application directory.

Returns

void

Parameters

(string) $file 
(string) $module 

$this->tester_base->load_page('$page', [$post=array()])

Loads the results of call to a controller. Additionally creates pq function to query dom nodes.

Returns

string

Parameters

(string) $page 
(array) $post 

$this->tester_base->page_contains('$match', ['$use_jquery'=TRUE])

Convenience method to test if something exists on a page. The first parameter is a string to match. The second parameter says whether to use jquery syntax to match a specific DOM node (TRUE), or to use regular [removed]FALSE).

Returns

void

Parameters

(string) $match 
(boolean) $use_jquery 

$this->tester_base->str_contains('$match', '$str', ['$use_jquery'=TRUE])

Convenience method to test if something exists in a string. The first parameter is a string to match. The second parameter is a string to test. The third parameter says whether to use jquery syntax to match a specific DOM node (TRUE), or to use regular [removed]FALSE).

Returns

void

Parameters

(string) $match 
(boolean) $str 

$this->tester_base->__destruct()

Magic method which will run the teardown method.

Returns

void