Skip to content
Snippets Groups Projects
Commit 73907171 authored by Dominik Eckelmann's avatar Dominik Eckelmann
Browse files

added first phpunit test

parent 9d421a3d
No related branches found
No related tags found
No related merge requests found
====== 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
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="unittests/bootstrap.php">
<testsuites>
<testsuite>
<directory suffix=".test.php">unittests/</directory>
</testsuite>
</testsuites>
</phpunit>
\ No newline at end of file
<?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');
<?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 :
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment