From f3cdc7f272e409d391979d3e6c58dd63573530c0 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 24 Aug 2009 15:46:12 -0400 Subject: Add unit test directory and first test --- tests/URLDetectionTest.php | 189 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 tests/URLDetectionTest.php (limited to 'tests/URLDetectionTest.php') diff --git a/tests/URLDetectionTest.php b/tests/URLDetectionTest.php new file mode 100644 index 000000000..f35b03eaf --- /dev/null +++ b/tests/URLDetectionTest.php @@ -0,0 +1,189 @@ +assertEquals($expected, $rendered); + } + + static public function provider() + { + return array( + array('example', + 'example'), + array('http://example', + 'http://example'), + array('http://example/', + 'http://example/'), + array('http://example/path', + 'http://example/path'), + array('http://example.com', + 'http://example.com'), + array('https://example.com', + 'https://example.com'), + array('ftp://example.com', + 'ftp://example.com'), + array('ftps://example.com', + 'ftps://example.com'), + array('http://user@example.com', + 'http://user@example.com'), + array('http://user:pass@example.com', + 'http://user:pass@example.com'), + array('http://example.com:8080', + 'http://example.com:8080'), + array('http://www.example.com', + 'http://www.example.com'), + array('http://example.com/', + 'http://example.com/'), + array('http://example.com/path', + 'http://example.com/path'), + array('http://example.com/path.html', + 'http://example.com/path.html'), + array('http://example.com/path.html#fragment', + 'http://example.com/path.html#fragment'), + array('http://example.com/path.php?foo=bar&bar=foo', + 'http://example.com/path.php?foo=bar&bar=foo'), + array('http://müllärör.de', + 'http://müllärör.de'), + array('http://ﺱﺲﺷ.com', + 'http://ﺱﺲﺷ.com'), + array('http://сделаткартинки.com', + 'http://сделаткартинки.com'), + array('http://tūdaliņ.lv', + 'http://tūdaliņ.lv'), + array('http://brændendekærlighed.com', + 'http://brændendekærlighed.com'), + array('http://あーるいん.com', + 'http://あーるいん.com'), + array('http://예비교사.com', + 'http://예비교사.com'), + array('http://example.com.', + 'http://example.com.'), + array('http://example.com?', + 'http://example.com?'), + array('http://example.com!', + 'http://example.com!'), + array('http://example.com,', + 'http://example.com,'), + array('http://example.com;', + 'http://example.com;'), + array('http://example.com:', + 'http://example.com:'), + array('\'http://example.com\'', + '\'http://example.com\''), + array('"http://example.com"', + '"http://example.com"'), + array('http://example.com ', + 'http://example.com'), + array('(http://example.com)', + '(http://example.com)'), + array('[http://example.com]', + '[http://example.com]'), + array('', + '<http://example.com>'), + array('http://example.com/path/(foo)/bar', + 'http://example.com/path/(foo)/bar'), + array('http://example.com/path/[foo]/bar', + 'http://example.com/path/[foo]/bar'), + array('http://example.com/path/foo/(bar)', + 'http://example.com/path/foo/(bar)'), + array('http://example.com/path/foo/[bar]', + 'http://example.com/path/foo/[bar]'), + array('Hey, check out my cool site http://example.com okay?', + 'Hey, check out my cool site http://example.com okay?'), + array('What about parens (e.g. http://example.com/path/foo/(bar))?', + 'What about parens (e.g. http://example.com/path/foo/(bar))?'), + array('What about parens (e.g. http://example.com/path/foo/(bar)?', + 'What about parens (e.g. http://example.com/path/foo/(bar)?'), + array('What about parens (e.g. http://example.com/path/foo/(bar).)?', + 'What about parens (e.g. http://example.com/path/foo/(bar).)?'), + array('What about parens (e.g. http://example.com/path/(foo,bar)?', + 'What about parens (e.g. http://example.com/path/(foo,bar)?'), + array('Unbalanced too (e.g. http://example.com/path/((((foo)/bar)?', + 'Unbalanced too (e.g. http://example.com/path/((((foo)/bar)?'), + array('Unbalanced too (e.g. http://example.com/path/(foo))))/bar)?', + 'Unbalanced too (e.g. http://example.com/path/(foo))))/bar)?'), + array('Unbalanced too (e.g. http://example.com/path/foo/((((bar)?', + 'Unbalanced too (e.g. http://example.com/path/foo/((((bar)?'), + array('Unbalanced too (e.g. http://example.com/path/foo/(bar))))?', + 'Unbalanced too (e.g. http://example.com/path/foo/(bar))))?'), + array('example.com', + 'example.com'), + array('example.org', + 'example.org'), + array('example.co.uk', + 'example.co.uk'), + array('www.example.co.uk', + 'www.example.co.uk'), + array('farm1.images.example.co.uk', + 'farm1.images.example.co.uk'), + array('example.museum', + 'example.museum'), + array('example.travel', + 'example.travel'), + array('example.com.', + 'example.com.'), + array('example.com?', + 'example.com?'), + array('example.com!', + 'example.com!'), + array('example.com,', + 'example.com,'), + array('example.com;', + 'example.com;'), + array('example.com:', + 'example.com:'), + array('\'example.com\'', + '\'example.com\''), + array('"example.com"', + '"example.com"'), + array('example.com ', + 'example.com'), + array('(example.com)', + '(example.com)'), + array('[example.com]', + '[example.com]'), + array('', + '<example.com>'), + array('Hey, check out my cool site example.com okay?', + 'Hey, check out my cool site example.com okay?'), + array('Hey, check out my cool site example.com.I made it.', + 'Hey, check out my cool site example.com.I made it.'), + array('Hey, check out my cool site example.com.Funny thing...', + 'Hey, check out my cool site example.com.Funny thing...'), + array('Hey, check out my cool site example.com.You will love it.', + 'Hey, check out my cool site example.com.You will love it.'), + array('What about parens (e.g. example.com/path/foo/(bar))?', + 'What about parens (e.g. example.com/path/foo/(bar))?'), + array('What about parens (e.g. example.com/path/foo/(bar)?', + 'What about parens (e.g. example.com/path/foo/(bar)?'), + array('What about parens (e.g. example.com/path/foo/(bar).)?', + 'What about parens (e.g. example.com/path/foo/(bar).)?'), + array('What about parens (e.g. example.com/path/(foo,bar)?', + 'What about parens (e.g. example.com/path/(foo,bar)?'), + array('file.ext', + 'file.ext'), + array('file.html', + 'file.html'), + array('file.php', + 'file.php') + ); + } +} + -- cgit v1.2.3-54-g00ecf