From 0df739ffb607c2c331e13476b5662445dd6bb03b Mon Sep 17 00:00:00 2001 From: peter279k Date: Fri, 27 Apr 2018 01:17:23 +0800 Subject: [PATCH] Test enhancement --- .travis.yml | 1 + composer.json | 7 ++++++- tests/DatabaseTest.php | 6 +++++- tests/ModelTest.php | 6 +++++- tests/PagerTest.php | 6 +++++- tests/RestResourceTest.php | 14 ++++++++------ tests/TableModelTest.php | 11 +++++++++-- 7 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7dcfdfc..8b63dea 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ php: - '5.6' - '7.0' - '7.1' + - '7.2' script: - vendor/bin/phpunit install: diff --git a/composer.json b/composer.json index 3edac2c..b0f8a7a 100755 --- a/composer.json +++ b/composer.json @@ -9,11 +9,16 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^5.7|^6.5" }, "autoload": { "psr-4": { "DbTools\\": "src/" } + }, + "autoload-dev": { + "psr-4": { + "DbTools\\Tests\\": "tests/" + } } } diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index c7f13ae..23bef39 100755 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -1,8 +1,12 @@ processRequest([ 'sort' => $sort ]); - if ( $sql ) { - $opt = $test->getModelFilters(); - $this->assertArrayHasKey('order_by', $opt); - $this->assertEquals($sql, $opt['order_by']); - } + + $opt = $test->getModelFilters(); + $this->assertArrayHasKey('order_by', $opt); + $this->assertEquals($sql, $opt['order_by']); } /** diff --git a/tests/TableModelTest.php b/tests/TableModelTest.php index 4b9b4a2..2c83087 100755 --- a/tests/TableModelTest.php +++ b/tests/TableModelTest.php @@ -1,7 +1,14 @@ assertInstanceOf('ConcreteTableModel', $obj); + $this->assertInstanceOf(ConcreteTableModel::class, $obj); $this->assertNotEmpty(ConcreteTableModel::getLastSelectQuery()); }