diff options
| author | Nils Adermann <naderman@naderman.de> | 2013-03-27 06:31:53 +0100 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2013-03-27 06:31:53 +0100 |
| commit | b7778f7fdedf39896d54703ce8cae459e94fe8d1 (patch) | |
| tree | c9b8cce3c99479865b5a8d40c838fb67dfc024b5 /tests/test_framework/phpbb_functional_test_case.php | |
| parent | c9aa39be5de14ff50c27cd5246b85844855da844 (diff) | |
| parent | d3decaeedff926f2945285b713e85c09c3de9daf (diff) | |
| download | forums-b7778f7fdedf39896d54703ce8cae459e94fe8d1.tar forums-b7778f7fdedf39896d54703ce8cae459e94fe8d1.tar.gz forums-b7778f7fdedf39896d54703ce8cae459e94fe8d1.tar.bz2 forums-b7778f7fdedf39896d54703ce8cae459e94fe8d1.tar.xz forums-b7778f7fdedf39896d54703ce8cae459e94fe8d1.zip | |
Merge remote-tracking branch 'github-bantu/ticket/11460' into develop
* github-bantu/ticket/11460:
[ticket/11460] Add default behaviour tests for notification and email types.
[ticket/11460] Configure functional test board email using dummy SMTP data.
[ticket/11460] Add test for whether post_email and topic_email are checked.
[ticket/11460] Add methods for checkbox handling to phpbb_functional_test_case.
[ticket/11460] Drop incorrect phpbb_notification_{type,method}_ prefix.
Diffstat (limited to 'tests/test_framework/phpbb_functional_test_case.php')
| -rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 76 |
1 files changed, 70 insertions, 6 deletions
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 887dfea3b5..a411d9c98a 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -196,12 +196,12 @@ class phpbb_functional_test_case extends phpbb_test_case $parseURL = parse_url(self::$config['phpbb_functional_url']); $data = array_merge($data, array( - 'email_enable' => false, - 'smtp_delivery' => false, - 'smtp_host' => '', - 'smtp_auth' => '', - 'smtp_user' => '', - 'smtp_pass' => '', + 'email_enable' => true, + 'smtp_delivery' => true, + 'smtp_host' => 'nxdomain.phpbb.com', + 'smtp_auth' => '', + 'smtp_user' => 'nxuser', + 'smtp_pass' => 'nxpass', 'cookie_secure' => false, 'force_server_vars' => false, 'server_protocol' => $parseURL['scheme'] . '://', @@ -463,4 +463,68 @@ class phpbb_functional_test_case extends phpbb_test_case $this->assertGreaterThan(0, count($nodes), $msg); return $nodes; } + + /** + * Asserts that exactly one checkbox with name $name exists within the scope + * of $crawler and that the checkbox is checked. + * + * @param Symfony\Component\DomCrawler\Crawler $crawler + * @param string $name + * @param string $message + * + * @return null + */ + public function assert_checkbox_is_checked($crawler, $name, $message = '') + { + $this->assertSame( + 'checked', + $this->assert_find_one_checkbox($crawler, $name)->attr('checked'), + $message ?: "Failed asserting that checkbox $name is checked." + ); + } + + /** + * Asserts that exactly one checkbox with name $name exists within the scope + * of $crawler and that the checkbox is unchecked. + * + * @param Symfony\Component\DomCrawler\Crawler $crawler + * @param string $name + * @param string $message + * + * @return null + */ + public function assert_checkbox_is_unchecked($crawler, $name, $message = '') + { + $this->assertSame( + '', + $this->assert_find_one_checkbox($crawler, $name)->attr('checked'), + $message ?: "Failed asserting that checkbox $name is unchecked." + ); + } + + /** + * 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. + * + * @param Symfony\Component\DomCrawler\Crawler $crawler + * @param string $name + * @param string $message + * + * @return Symfony\Component\DomCrawler\Crawler + */ + public function assert_find_one_checkbox($crawler, $name, $message = '') + { + $query = sprintf('//input[@type="checkbox" and @name="%s"]', $name); + $result = $crawler->filterXPath($query); + + $this->assertEquals( + 1, + sizeof($result), + $message ?: 'Failed asserting that exactly one checkbox with name' . + " $name exists in crawler scope." + ); + + return $result; + } } |
