diff --git a/Tests/.htaccess b/Tests/.htaccess new file mode 100644 index 0000000..8d2f256 --- /dev/null +++ b/Tests/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/Tests/TESTS b/Tests/TESTS new file mode 100755 index 0000000..6957b34 --- /dev/null +++ b/Tests/TESTS @@ -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 diff --git a/Tests/autoload.php b/Tests/autoload.php new file mode 100644 index 0000000..3ed1e23 --- /dev/null +++ b/Tests/autoload.php @@ -0,0 +1,6 @@ +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)); + } +}