Adding PHPUnit tests
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1208 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
1
Tests/.htaccess
Normal file
1
Tests/.htaccess
Normal file
@@ -0,0 +1 @@
|
|||||||
|
deny from all
|
||||||
12
Tests/TESTS
Executable file
12
Tests/TESTS
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#To run the tests, you need "phpunit" software.
|
||||||
|
# All the documentation is here :
|
||||||
|
# phpunit.de/manual/current/en/writing-tests-for-phpunit.html
|
||||||
|
|
||||||
|
#From the root dir of the project, run the tests like :
|
||||||
|
cd `dirname $0`/..
|
||||||
|
phpunit --bootstrap Tests/autoload.php Tests/test*
|
||||||
|
|
||||||
|
# You can run specific test with :
|
||||||
|
# cd `dirname $0`/..
|
||||||
|
# phpunit --bootstrap Tests/autoload.php Tests/testXXXXXXX.php
|
||||||
6
Tests/autoload.php
Normal file
6
Tests/autoload.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
// Autoload
|
||||||
|
spl_autoload_register(function ($class) {
|
||||||
|
@include $class . '.php';
|
||||||
|
});
|
||||||
|
|
||||||
24
Tests/test_outputjson.php
Normal file
24
Tests/test_outputjson.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
class test_outputjson extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function testoutputjson1 ()
|
||||||
|
{
|
||||||
|
$this->expectOutputString("\"\"");
|
||||||
|
$output = new outputjson ();
|
||||||
|
$output->out ("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testoutputjson2 ()
|
||||||
|
{
|
||||||
|
$this->expectOutputString("\"string\"");
|
||||||
|
$output = new outputjson ();
|
||||||
|
$output->out ("string");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testoutputjson3 ()
|
||||||
|
{
|
||||||
|
$this->expectOutputString("[1,2,3]");
|
||||||
|
$output = new outputjson ();
|
||||||
|
$output->out (array (1,2,3));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user