summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-05-21 14:45:53 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-21 18:43:13 +0200
commit77198abd94437eb418f11957695986470b1afc9a (patch)
tree710b0285a00aa3f54db274ff01a9eb21017c2164
parenteb9daf07b1a118b473d352c98c5822c3063e598d (diff)
tests: Make prove --state work; Restructure tests
This moves all tests into a subdirectory and lets prove itself figure out which tests exist. It seems if you supply the testlist via arguments or stdin --state won't affect the order. Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/controllers/tools.php7
-rw-r--r--application/test/Test.php (renamed from application/tests/Test.php)2
-rw-r--r--application/test/tests/test_api_v1.php (renamed from application/tests/test_api_v1.php)4
-rw-r--r--application/test/tests/test_libraries_image.php (renamed from application/tests/test_libraries_image.php)4
-rw-r--r--application/test/tests/test_libraries_pygments.php (renamed from application/tests/test_libraries_pygments.php)4
-rw-r--r--application/test/tests/test_service_files.php (renamed from application/tests/test_service_files.php)4
-rw-r--r--application/test/tests/test_service_files_valid_id.php (renamed from application/tests/test_service_files_valid_id.php)4
-rwxr-xr-xrun-tests.sh6
8 files changed, 17 insertions, 18 deletions
diff --git a/application/controllers/tools.php b/application/controllers/tools.php
index d1d5ba39b..d38ab7c39 100644
--- a/application/controllers/tools.php
+++ b/application/controllers/tools.php
@@ -70,8 +70,11 @@ class Tools extends MY_Controller {
$url = $argv[3];
$testcase = $argv[4];
- $testclass = '\tests\\'.$testcase;
- $test = new $testclass();
+ $testcase = str_replace("application/", "", $testcase);
+ $testcase = str_replace("/", "\\", $testcase);
+ $testcase = str_replace(".php", "", $testcase);
+
+ $test = new $testcase();
$test->setServer($url);
$exitcode = 0;
diff --git a/application/tests/Test.php b/application/test/Test.php
index c11cd0cc4..925fe131e 100644
--- a/application/tests/Test.php
+++ b/application/test/Test.php
@@ -7,7 +7,7 @@
*
*/
-namespace tests;
+namespace test;
require_once APPPATH."/third_party/test-more-php/Test-More-OO.php";
diff --git a/application/tests/test_api_v1.php b/application/test/tests/test_api_v1.php
index 378f741de..cdac30544 100644
--- a/application/tests/test_api_v1.php
+++ b/application/test/tests/test_api_v1.php
@@ -7,9 +7,9 @@
*
*/
-namespace tests;
+namespace test\tests;
-class test_api_v1 extends Test {
+class test_api_v1 extends \test\Test {
public function __construct()
{
diff --git a/application/tests/test_libraries_image.php b/application/test/tests/test_libraries_image.php
index fb34d794e..13c9e67b9 100644
--- a/application/tests/test_libraries_image.php
+++ b/application/test/tests/test_libraries_image.php
@@ -7,9 +7,9 @@
*
*/
-namespace tests;
+namespace test\tests;
-class test_libraries_image extends Test {
+class test_libraries_image extends \test\Test {
public function __construct()
{
diff --git a/application/tests/test_libraries_pygments.php b/application/test/tests/test_libraries_pygments.php
index f88a4bcbd..768bca439 100644
--- a/application/tests/test_libraries_pygments.php
+++ b/application/test/tests/test_libraries_pygments.php
@@ -7,9 +7,9 @@
*
*/
-namespace tests;
+namespace test\tests;
-class test_libraries_pygments extends Test {
+class test_libraries_pygments extends \test\Test {
public function __construct()
{
diff --git a/application/tests/test_service_files.php b/application/test/tests/test_service_files.php
index 8789a9888..21688230f 100644
--- a/application/tests/test_service_files.php
+++ b/application/test/tests/test_service_files.php
@@ -7,9 +7,9 @@
*
*/
-namespace tests;
+namespace test\tests;
-class test_service_files extends Test {
+class test_service_files extends \test\Test {
public function __construct()
{
diff --git a/application/tests/test_service_files_valid_id.php b/application/test/tests/test_service_files_valid_id.php
index c090dcbd9..24886be43 100644
--- a/application/tests/test_service_files_valid_id.php
+++ b/application/test/tests/test_service_files_valid_id.php
@@ -7,9 +7,9 @@
*
*/
-namespace tests;
+namespace test\tests;
-class test_service_files_valid_id extends Test {
+class test_service_files_valid_id extends \test\Test {
private $model;
private $filedata;
private $config;
diff --git a/run-tests.sh b/run-tests.sh
index 0057b4d75..5d1c2597c 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -49,13 +49,9 @@ if ((use_php_dev_server)); then
done
fi
-testpath="application/tests"
-tests=($testpath/test_*.php)
-tests=(${tests[@]#$testpath\/})
-tests=(${tests[@]%.php})
# run tests
php index.php tools drop_all_tables_using_prefix
php index.php tools update_database
-prove --state=hot,slow,save --timer -ve "php index.php tools test $url" "${tests[@]}"
+prove --ext .php --state=hot,slow,all,save --timer -ve "php index.php tools test $url" -r application/test/tests/