[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/phpunit/classes/ -> util.php (summary)

Utility class.

Copyright: 2012 Petr Skoda {@link http://skodak.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 820 lines (27 kb)
Included or required: 2 times
Referenced: 1 time
Includes or requires: 1 file
 lib/testing/classes/util.php

Defines 1 class

phpunit_util:: (28 methods):
  initialise_cfg()
  reset_all_data()
  reset_database()
  bootstrap_init()
  bootstrap_moodle_info()
  get_global_backup()
  testing_ready_problem()
  drop_site()
  install_site()
  build_config_file()
  build_component_config_files()
  debugging_triggered()
  reset_debugging()
  get_debugging_messages()
  display_debugging_messages()
  start_message_redirection()
  stop_message_redirection()
  is_redirecting_messages()
  message_sent()
  start_phpmailer_redirection()
  stop_phpmailer_redirection()
  is_redirecting_phpmailer()
  phpmailer_sent()
  start_event_redirection()
  stop_event_redirection()
  is_redirecting_events()
  event_triggered()
  get_locale_name()


Class: phpunit_util  - X-Ref

Collection of utility methods.

initialise_cfg()   X-Ref
Load global $CFG;

return: void

reset_all_data($detectchanges = false)   X-Ref
Reset contents of all database tables to initial values, reset caches, etc.

Note: this is relatively slow (cca 2 seconds for pg and 7 for mysql) - please use with care!

param: bool $detectchanges
return: void

reset_database()   X-Ref
Reset all database tables to default values.

return: bool true if reset done, false if skipped

bootstrap_init()   X-Ref
Called during bootstrap only!

return: void

bootstrap_moodle_info()   X-Ref
Print some Moodle related info to console.

return: void

get_global_backup($name)   X-Ref
Returns original state of global variable.

param: string $name
return: mixed

testing_ready_problem()   X-Ref
Is this site initialised to run unit tests?

return: int array errorcode=>message, 0 means ok

drop_site($displayprogress = false)   X-Ref
Drop all test site data.

Note: To be used from CLI scripts only.

param: bool $displayprogress if true, this method will echo progress information.
return: void may terminate execution with exit code

install_site()   X-Ref
Perform a fresh test site installation

Note: To be used from CLI scripts only.

return: void may terminate execution with exit code

build_config_file()   X-Ref
Builds dirroot/phpunit.xml and dataroot/phpunit/webrunner.xml files using defaults from /phpunit.xml.dist

return: bool true means main config file created, false means only dataroot file created

build_component_config_files()   X-Ref
Builds phpunit.xml files for all components using defaults from /phpunit.xml.dist

return: void, stops if can not write files

debugging_triggered($message, $level, $from)   X-Ref
To be called from debugging() only.

param: string $message
param: int $level
param: string $from

reset_debugging()   X-Ref
Resets the list of debugging messages.


get_debugging_messages()   X-Ref
Returns all debugging messages triggered during test.

return: array with instances having message, level and stacktrace property.

display_debugging_messages()   X-Ref
Prints out any debug messages accumulated during test execution.

return: bool false if no debug messages, true if debug triggered

start_message_redirection()   X-Ref
Start message redirection.

Note: Do not call directly from tests,
use $sink = $this->redirectMessages() instead.

return: phpunit_message_sink

stop_message_redirection()   X-Ref
End message redirection.

Note: Do not call directly from tests,
use $sink->close() instead.

is_redirecting_messages()   X-Ref
Are messages redirected to some sink?

Note: to be called from messagelib.php only!

return: bool

message_sent($message)   X-Ref
To be called from messagelib.php only!

param: stdClass $message record from message_read table
return: bool true means send message, false means message "sent" to sink.

start_phpmailer_redirection()   X-Ref
Start phpmailer redirection.

Note: Do not call directly from tests,
use $sink = $this->redirectEmails() instead.

return: phpunit_phpmailer_sink

stop_phpmailer_redirection()   X-Ref
End phpmailer redirection.

Note: Do not call directly from tests,
use $sink->close() instead.

is_redirecting_phpmailer()   X-Ref
Are messages for phpmailer redirected to some sink?

Note: to be called from moodle_phpmailer.php only!

return: bool

phpmailer_sent($message)   X-Ref
To be called from messagelib.php only!

param: stdClass $message record from message_read table
return: bool true means send message, false means message "sent" to sink.

start_event_redirection()   X-Ref
Start event redirection.

return: phpunit_event_sink

stop_event_redirection()   X-Ref
End event redirection.


is_redirecting_events()   X-Ref
Are events redirected to some sink?

Note: to be called from \core\event\base only!

return: bool

event_triggered(\core\event\base $event)   X-Ref
To be called from \core\event\base only!

param: \core\event\base $event record from event_read table
return: bool true means send event, false means event "sent" to sink.

get_locale_name()   X-Ref
Gets the name of the locale for testing environment (Australian English)
depending on platform environment.

return: string the locale name.



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