-
-
Notifications
You must be signed in to change notification settings - Fork 849
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
bootstrap="unittests/bootstrap.php"> | ||
|
||
<testsuites> | ||
<testsuite> | ||
<directory suffix=".test.php">unittests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
define('DOKU_UNITTEST',true); | ||
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); | ||
define('DOKU_CONF',realpath(dirname(__FILE__).'/../../conf').'/'); | ||
|
||
error_reporting(E_ALL); | ||
set_time_limit(600); | ||
ini_set('memory_limit','128M'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
require_once DOKU_INC . 'inc/init.php'; | ||
require_once DOKU_INC . 'inc/common.php'; | ||
|
||
class common_clientIP_test extends PHPUnit_Framework_TestCase { | ||
|
||
function test_unix(){ | ||
$unix = 'one | ||
two | ||
three'; | ||
|
||
$this->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 : |