aboutsummaryrefslogtreecommitdiffstats
path: root/tests/regex/url.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2010-06-17 18:50:41 +0200
committerAndreas Fischer <bantu@phpbb.com>2010-06-17 18:50:41 +0200
commit876a6e4686bbad12c456c87a7c96bc4486bd3d17 (patch)
treeba5b2e1a9318b4c8a39c4c490b975e35c2f95f9e /tests/regex/url.php
parent26057fe3ff1bd075ec1699a8b8d4bdc4dd0fd47f (diff)
parentaaaa4f9abe8665946b79cc55bf3a4d7e0133b6c9 (diff)
downloadforums-876a6e4686bbad12c456c87a7c96bc4486bd3d17.tar
forums-876a6e4686bbad12c456c87a7c96bc4486bd3d17.tar.gz
forums-876a6e4686bbad12c456c87a7c96bc4486bd3d17.tar.bz2
forums-876a6e4686bbad12c456c87a7c96bc4486bd3d17.tar.xz
forums-876a6e4686bbad12c456c87a7c96bc4486bd3d17.zip
Merge branch 'ticket/bantu/9626' into develop-olympus
* ticket/bantu/9626: [ticket/9626] Adding tests for the URL regular expression. [ticket/9626] Add missing class prefix. [ticket/9626] A few tests for the email regular expression. [ticket/9626] More IPv6 regex tests. [ticket/9626] Adding tests for the IPv4 regular expression. [ticket/9626] Adding tests for regular expressions.
Diffstat (limited to 'tests/regex/url.php')
-rw-r--r--tests/regex/url.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/regex/url.php b/tests/regex/url.php
new file mode 100644
index 0000000000..678b7d108f
--- /dev/null
+++ b/tests/regex/url.php
@@ -0,0 +1,34 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2010 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+require_once 'test_framework/framework.php';
+require_once '../phpBB/includes/functions.php';
+
+class phpbb_regex_url_test extends phpbb_test_case
+{
+ public function url_test_data()
+ {
+ return array(
+ array('http://www.phpbb.com/community/', 1),
+ array('http://www.phpbb.com/path/file.ext#section', 1),
+ array('ftp://ftp.phpbb.com/', 1),
+ array('sip://bantu@phpbb.com', 1),
+
+ array('www.phpbb.com/community/', 0),
+ );
+ }
+
+ /**
+ * @dataProvider url_test_data
+ */
+ public function test_url($url, $expected)
+ {
+ $this->assertEquals($expected, preg_match('#^' . get_preg_expression('url') . '$#i', $url));
+ }
+}