From 739071715cb5267191e4a5b5824fbc28a2fa3ef4 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 1 Apr 2012 18:31:34 +0200 Subject: added first phpunit test --- _testing/README | 15 +++++++++++++ _testing/unittest.xml | 11 ++++++++++ _testing/unittests/bootstrap.php | 9 ++++++++ _testing/unittests/inc/common_cleanText.test.php | 28 ++++++++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 _testing/README create mode 100644 _testing/unittest.xml create mode 100644 _testing/unittests/bootstrap.php create mode 100644 _testing/unittests/inc/common_cleanText.test.php (limited to '_testing') diff --git a/_testing/README b/_testing/README new file mode 100644 index 000000000..02f00fd5d --- /dev/null +++ b/_testing/README @@ -0,0 +1,15 @@ +====== DokuWiki test suite ====== + + +===== Unit Tests ===== + +==== Requirements ==== + * PHP Unit 3.7 + +Installation: +The easiest way to install phpunit is via pear: + pear config-set auto_discover 1 + pear install pear.phpunit.de/PHPUnit + +==== Run unit tests ==== + phpunit -c _testing/unittest.xml \ No newline at end of file diff --git a/_testing/unittest.xml b/_testing/unittest.xml new file mode 100644 index 000000000..e0058eaca --- /dev/null +++ b/_testing/unittest.xml @@ -0,0 +1,11 @@ + + + + + + unittests/ + + + + \ No newline at end of file diff --git a/_testing/unittests/bootstrap.php b/_testing/unittests/bootstrap.php new file mode 100644 index 000000000..27ca1635e --- /dev/null +++ b/_testing/unittests/bootstrap.php @@ -0,0 +1,9 @@ +assertEquals($unix,cleanText($unix)); + } + + function test_win(){ + $unix = "one\ntwo\nthree"; + $win = "one\r\ntwo\r\nthree"; + + $this->assertEquals(bin2hex($unix), '6f6e650a74776f0a7468726565'); + $this->assertEquals(bin2hex($win), '6f6e650d0a74776f0d0a7468726565'); + $this->assertNotEquals($unix, $win); + $this->assertEquals($unix, cleanText($win)); + } +} + +//Setup VIM: ex: et ts=4 : -- cgit v1.2.3