diff options
author | uckelman <uckelman@nomic.net> | 2010-10-31 20:53:21 +0000 |
---|---|---|
committer | uckelman <uckelman@nomic.net> | 2010-10-31 20:53:21 +0000 |
commit | 88d4c55ec38c68c07496ed059616b15622fc83e7 (patch) | |
tree | d54d2449e66d359cac3d4bc6171e072c4832b1f8 /test/UtilTest.php | |
parent | 54551bc4cb0dee8549c229d18fca3bf3dc0d5c48 (diff) |
Major refactoring to make bridge easier to test.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@7431 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'test/UtilTest.php')
-rw-r--r-- | test/UtilTest.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/UtilTest.php b/test/UtilTest.php new file mode 100644 index 0000000..7135b9f --- /dev/null +++ b/test/UtilTest.php @@ -0,0 +1,48 @@ +<?php + +require_once('PHPUnit/Framework.php'); + +require_once(__DIR__ . '/../src/Util.php'); + +class UtilTest extends PHPUnit_Framework_TestCase { + public function is_ascii_provider() { + return array( + array('', true), + array('foo', true), + array('Heizölrückstoßabdämpfung', false) + ); + } + + /** @dataProvider is_ascii_provider */ + public function test_is_ascii($string, $expected) { + $this->assertEquals($expected, is_ascii($string)); + } + + public function utf8_quote_provider() { + return array( + array('', '=?UTF-8?B??='), + array('foo', '=?UTF-8?B?Zm9v?='), + array('Heizölrückstoßabdämpfung', '=?UTF-8?B?SGVpesO2bHLDvGNrc3Rvw59hYmTDpG1wZnVuZw==?=') + ); + } + + /** @dataProvider utf8_quote_provider */ + public function test_utf8_quote($string, $expected) { + $this->assertEquals($expected, utf8_quote($string)); + } + + public function utf8_quote_non_ascii_provider() { + return array( + array('', ''), + array('foo', 'foo'), + array('Heizölrückstoßabdämpfung', '=?UTF-8?B?SGVpesO2bHLDvGNrc3Rvw59hYmTDpG1wZnVuZw==?=') + ); + } + + /** @dataProvider utf8_quote_non_ascii_provider */ + public function test_utf8_quote_non_ascii($string, $expected) { + $this->assertEquals($expected, utf8_quote_non_ascii($string)); + } +} + +?> |