From: Florent Bruneau Date: Thu, 11 Mar 2010 10:04:33 +0000 (+0100) Subject: Improves unit testing. X-Git-Tag: core/1.1.0~52 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=536fc7f7d2c9880d4c61469bcee6daaee73afaf5;p=platal.git Improves unit testing. Signed-off-by: Florent Bruneau --- diff --git a/Makefile b/Makefile index 13da69d..ed1959d 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ all: build build: include/version.inc.php test: - make -C ut test + phpunit pltestsuite classes/pltestsuite.php clean: -rm include/version.inc.php diff --git a/classes/pltestcase.php b/classes/pltestcase.php new file mode 100644 index 0000000..cd59154 --- /dev/null +++ b/classes/pltestcase.php @@ -0,0 +1,29 @@ + diff --git a/classes/pltestsuite.php b/classes/pltestsuite.php new file mode 100644 index 0000000..889547c --- /dev/null +++ b/classes/pltestsuite.php @@ -0,0 +1,50 @@ +addTestSuite($class); + } + $suite->addTest($subsuite); + } + return $suite; + } +} + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: +?> diff --git a/include/test.inc.php b/include/test.inc.php index a5a4fd7..0ff3d69 100644 --- a/include/test.inc.php +++ b/include/test.inc.php @@ -19,16 +19,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require_once dirname(__FILE__) . '/platal.inc.php'; -require_once 'PHPUnit/Framework.php'; +if (!@include_once dirname(__FILE__) . '/../../include/test.inc.php') { + require_once dirname(__FILE__) . '/platal.inc.php'; + require_once 'PHPUnit/Framework.php'; -function __autoload($class) -{ - pl_autoload($class); -} - -abstract class PlTestCase extends PHPUnit_Framework_TestCase -{ + function __autoload($class) + { + pl_autoload($class); + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/ut/Makefile b/ut/Makefile deleted file mode 100644 index 3456003..0000000 --- a/ut/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -files=$(addprefix test-,$(wildcard *.php)) - -test: $(files) - echo "$(files)" - -test-%: - phpunit $* - -.PHONY: test test-% diff --git a/ut/arrayiteratortest.php b/ut/arrayiteratortest.php index b990612..96c4932 100644 --- a/ut/arrayiteratortest.php +++ b/ut/arrayiteratortest.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -include_once dirname(__FILE__) . '/../include/test.inc.php'; +require_once dirname(__FILE__) . '/../include/test.inc.php'; class ArrayIteratorTest extends PlTestCase { diff --git a/ut/xdbtest.php b/ut/xdbtest.php index 3cc96e6..72b1686 100644 --- a/ut/xdbtest.php +++ b/ut/xdbtest.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -include_once dirname(__FILE__) . '/../include/test.inc.php'; +require_once dirname(__FILE__) . '/../include/test.inc.php'; class XDBTest extends PlTestCase {