PHP Class phpbb_functional_test_case

Inheritance: extends phpbb_test_case
Datei anzeigen Open project: phpbb/phpbb Class Usage Examples

Protected Properties

Property Type Description
$already_installed
$cache
$client
$client Goutte\Client
$config
$cookieJar
$db
$extension_manager
$install_success
$lang array Language array used by phpBB
$last_post_timestamp
$root_url
$sid string Session ID for current test's session (each test makes its own)

Public Methods

Method Description
__construct ( $name = NULL, array $data = [], $dataName = '' )
assertContainsLang ( string $needle, string $haystack, string $message = null ) assertContains for language strings
assertNotContainsLang ( string $needle, string $haystack, string $message = null ) assertNotContains for language strings
assert_checkbox_is_checked ( Symfony\Component\DomCrawler\Crawler $crawler, string $name, string $message = '' ) : null Asserts that exactly one checkbox with name $name exists within the scope of $crawler and that the checkbox is checked.
assert_checkbox_is_unchecked ( Symfony\Component\DomCrawler\Crawler $crawler, string $name, string $message = '' ) : null Asserts that exactly one checkbox with name $name exists within the scope of $crawler and that the checkbox is unchecked.
assert_filter ( $crawler, $expr, $msg = null )
assert_find_one_checkbox ( Symfony\Component\DomCrawler\Crawler $crawler, string $name, string $message = '' ) : Symfony\Component\DomCrawler\Crawler Searches for an input element of type checkbox with the name $name using $crawler. Contains an assertion that only one such checkbox exists within the scope of $crawler.
assert_response_html ( $status_code = 200 ) * Perform some basic assertions for the page
assert_response_status_code ( integer $status_code = 200 ) : null Heuristic function to check that the response is success.
assert_response_xml ( $status_code = 200 ) * Perform some basic assertions for an xml page
create_post ( integer $forum_id, integer $topic_id, string $subject, string $message, array $additional_form_data = [], string $expected = '' ) : array | null Creates a post
create_private_message ( string $subject, string $message, array $to, array $additional_form_data = [] ) : integer Creates a private message
create_topic ( integer $forum_id, string $subject, string $message, array $additional_form_data = [], string $expected = '' ) : array | null Creates a topic
delete_post ( integer $forum_id, $post_id ) : null Deletes a post
delete_topic ( integer $topic_id ) : null Deletes a topic
get_content ( ) : string Get Client Content
get_parameter_from_link ( string $url, string $parameter ) : string Returns the requested parameter from a URL
get_passwords_manager ( ) : phpbb\passwords\manager Return a passwords manager instance
get_quickmod_page ( integer $topic_id, string $action, $crawler = false ) : Symfony\Component\DomCrawler\Crawler Get quickmod page
install_ext ( $extension )
request ( string $method, string $path, array $form_data = [], boolean $assert_response_html = true ) : Symfony\Component\DomCrawler\Crawler Perform a request to page
setUp ( )
setUpBeforeClass ( )
submit ( Symfony\Component\DomCrawler\Form $form, array $values = [], boolean $assert_response_html = true ) : Symfony\Component\DomCrawler\Crawler Submits a form

Protected Methods

Method Description
add_lang ( $lang_file )
add_lang_ext ( $ext_name, $lang_file )
add_style ( string $style_id, string $style_path, string $parent_style_id = 1, string $parent_style_path = 'prosilver' ) Creates a new style
add_user_group ( $group_name, $usernames, $default = false, $leader = false )
admin_login ( $username = 'admin' ) Login to the ACP You must run login() before calling this.
bootstrap ( ) test cases can override this
create_user ( string $username ) : integer Creates a new user with limited permissions
delete_style ( string $style_id, string $style_path ) Remove temporary style created by add_style()
get_cache_driver ( )
get_db ( )
get_extension_manager ( )
install_board ( )
lang ( )
login ( $username = 'admin' )
logout ( )
purge_cache ( )
remove_user_group ( $group_name, $usernames )
setup_extensions ( ) : array
submit_message ( string $posting_url, string $posting_contains, array $form_data ) : Crawler Helper for submitting a message (post or private message)
submit_post ( string $posting_url, string $posting_contains, array $form_data, string $expected = '' ) : array | null Helper for submitting posts
tearDown ( )

Private Methods

Method Description
recreate_database ( $config )

Method Details

__construct() public method

public __construct ( $name = NULL, array $data = [], $dataName = '' )
$data array

add_lang() protected method

protected add_lang ( $lang_file )

add_lang_ext() protected method

protected add_lang_ext ( $ext_name, $lang_file )

add_style() protected method

Creates a new style
protected add_style ( string $style_id, string $style_path, string $parent_style_id = 1, string $parent_style_path = 'prosilver' )
$style_id string Style ID
$style_path string Style directory
$parent_style_id string Parent style id. Default = 1
$parent_style_path string Parent style directory. Default = 'prosilver'

add_user_group() protected method

protected add_user_group ( $group_name, $usernames, $default = false, $leader = false )

admin_login() protected method

Login to the ACP You must run login() before calling this.
protected admin_login ( $username = 'admin' )

assertContainsLang() public method

assertContains for language strings
public assertContainsLang ( string $needle, string $haystack, string $message = null )
$needle string Search string
$haystack string Search this
$message string Optional failure message

assertNotContainsLang() public method

assertNotContains for language strings
public assertNotContainsLang ( string $needle, string $haystack, string $message = null )
$needle string Search string
$haystack string Search this
$message string Optional failure message

assert_checkbox_is_checked() public method

Asserts that exactly one checkbox with name $name exists within the scope of $crawler and that the checkbox is checked.
public assert_checkbox_is_checked ( Symfony\Component\DomCrawler\Crawler $crawler, string $name, string $message = '' ) : null
$crawler Symfony\Component\DomCrawler\Crawler
$name string
$message string
return null

assert_checkbox_is_unchecked() public method

Asserts that exactly one checkbox with name $name exists within the scope of $crawler and that the checkbox is unchecked.
public assert_checkbox_is_unchecked ( Symfony\Component\DomCrawler\Crawler $crawler, string $name, string $message = '' ) : null
$crawler Symfony\Component\DomCrawler\Crawler
$name string
$message string
return null

assert_filter() public method

public assert_filter ( $crawler, $expr, $msg = null )

assert_find_one_checkbox() public method

Searches for an input element of type checkbox with the name $name using $crawler. Contains an assertion that only one such checkbox exists within the scope of $crawler.
public assert_find_one_checkbox ( Symfony\Component\DomCrawler\Crawler $crawler, string $name, string $message = '' ) : Symfony\Component\DomCrawler\Crawler
$crawler Symfony\Component\DomCrawler\Crawler
$name string
$message string
return Symfony\Component\DomCrawler\Crawler

assert_response_html() public static method

Checks for debug/error output before the actual page content and the status code
public static assert_response_html ( $status_code = 200 )
$status_code Expected status code, false to disable check

assert_response_status_code() public static method

When php decides to die with a fatal error, it still sends 200 OK status code. This assertion tries to catch that.
public static assert_response_status_code ( integer $status_code = 200 ) : null
$status_code integer Expected status code
return null

assert_response_xml() public static method

Checks for debug/error output before the actual page content and the status code
public static assert_response_xml ( $status_code = 200 )
$status_code Expected status code, false to disable check

bootstrap() protected method

test cases can override this
protected bootstrap ( )

create_post() public method

Be sure to login before creating
public create_post ( integer $forum_id, integer $topic_id, string $subject, string $message, array $additional_form_data = [], string $expected = '' ) : array | null
$forum_id integer
$topic_id integer
$subject string
$message string
$additional_form_data array Any additional form data to be sent in the request
$expected string Lang var of expected message after posting
return array | null post_id, topic_id if message is empty

create_private_message() public method

Be sure to login before creating
public create_private_message ( string $subject, string $message, array $to, array $additional_form_data = [] ) : integer
$subject string
$message string
$to array
$additional_form_data array Any additional form data to be sent in the request
return integer private_message_id

create_topic() public method

Be sure to login before creating
public create_topic ( integer $forum_id, string $subject, string $message, array $additional_form_data = [], string $expected = '' ) : array | null
$forum_id integer
$subject string
$message string
$additional_form_data array Any additional form data to be sent in the request
$expected string Lang var of expected message after posting
return array | null post_id, topic_id if message is empty

create_user() protected method

Creates a new user with limited permissions
protected create_user ( string $username ) : integer
$username string Also doubles up as the user's password
return integer ID of created user

delete_post() public method

Be sure to login before creating
public delete_post ( integer $forum_id, $post_id ) : null
$forum_id integer
return null

delete_style() protected method

Remove temporary style created by add_style()
protected delete_style ( string $style_id, string $style_path )
$style_id string Style ID
$style_path string Style directory

delete_topic() public method

Be sure to login before creating
public delete_topic ( integer $topic_id ) : null
$topic_id integer
return null

get_cache_driver() protected method

protected get_cache_driver ( )

get_content() public static method

Get Client Content
public static get_content ( ) : string
return string HTML page

get_db() protected method

protected get_db ( )

get_extension_manager() protected method

protected get_extension_manager ( )

get_passwords_manager() public method

Return a passwords manager instance
public get_passwords_manager ( ) : phpbb\passwords\manager
return phpbb\passwords\manager

get_quickmod_page() public method

Get quickmod page
public get_quickmod_page ( integer $topic_id, string $action, $crawler = false ) : Symfony\Component\DomCrawler\Crawler
$topic_id integer
$action string Language key for the quickmod action
return Symfony\Component\DomCrawler\Crawler

install_board() protected static method

protected static install_board ( )

install_ext() public method

public install_ext ( $extension )

lang() protected method

protected lang ( )

login() protected method

protected login ( $username = 'admin' )

logout() protected method

protected logout ( )

purge_cache() protected method

protected purge_cache ( )

remove_user_group() protected method

protected remove_user_group ( $group_name, $usernames )

request() public static method

Perform a request to page
public static request ( string $method, string $path, array $form_data = [], boolean $assert_response_html = true ) : Symfony\Component\DomCrawler\Crawler
$method string HTTP Method
$path string Page path, relative from phpBB root path
$form_data array An array of form field values
$assert_response_html boolean Should we perform standard assertions for a normal html page
return Symfony\Component\DomCrawler\Crawler

setUp() public method

public setUp ( )

setUpBeforeClass() public static method

public static setUpBeforeClass ( )

setup_extensions() protected static method

protected static setup_extensions ( ) : array
return array List of extensions that should be set up

submit() public static method

Submits a form
public static submit ( Symfony\Component\DomCrawler\Form $form, array $values = [], boolean $assert_response_html = true ) : Symfony\Component\DomCrawler\Crawler
$form Symfony\Component\DomCrawler\Form A Form instance
$values array An array of form field values
$assert_response_html boolean Should we perform standard assertions for a normal html page
return Symfony\Component\DomCrawler\Crawler

submit_message() protected method

Helper for submitting a message (post or private message)
protected submit_message ( string $posting_url, string $posting_contains, array $form_data ) : Crawler
$posting_url string
$posting_contains string
$form_data array
return Symfony\Component\DomCrawler\Crawler the crawler object

submit_post() protected method

Helper for submitting posts
protected submit_post ( string $posting_url, string $posting_contains, array $form_data, string $expected = '' ) : array | null
$posting_url string
$posting_contains string
$form_data array
$expected string Lang var of expected message after posting
return array | null post_id, topic_id if message is empty

tearDown() protected method

protected tearDown ( )

Property Details

$already_installed protected_oe static_oe property

protected static $already_installed

$cache protected_oe property

protected $cache

$client protected_oe static_oe property

protected static $client

$client protected_oe static_oe property

protected static Client,Goutte $client
return Goutte\Client

$config protected_oe static_oe property

protected static $config

$cookieJar protected_oe static_oe property

protected static $cookieJar

$db protected_oe property

protected $db

$extension_manager protected_oe property

protected $extension_manager

$install_success protected_oe static_oe property

protected static $install_success

$lang protected_oe property

Language array used by phpBB
protected array $lang
return array

$last_post_timestamp protected_oe static_oe property

protected static $last_post_timestamp

$root_url protected_oe static_oe property

protected static $root_url

$sid protected_oe property

Session ID for current test's session (each test makes its own)
protected string $sid
return string