From a1ae0f374670158303ade6ec947e69c20fca8785 Mon Sep 17 00:00:00 2001 From: alext Date: Sat, 3 Nov 2018 17:10:34 +0100 Subject: [PATCH] Updated phpunit tests for phpunit v7 --- tests/phpunit/engine/Api/V1/AuthorizationTest.php | 5 +++-- tests/phpunit/engine/Api/V1/FilterTest.php | 4 +++- tests/phpunit/engine/Api/V1/MinimizeTest.php | 4 +++- tests/phpunit/engine/Api/V1/PaginationTest.php | 4 +++- tests/phpunit/engine/Api/V1/ResponseTest.php | 4 +++- tests/phpunit/engine/Api/V1/SearchTest.php | 4 +++- tests/phpunit/engine/Api/V1/SortTest.php | 4 +++- tests/phpunit/engine/{Types => Type}/BooleanTest.php | 8 +++++--- tests/phpunit/engine/{Types => Type}/DecimalTest.php | 8 +++++--- tests/phpunit/engine/{Types => Type}/EmailTest.php | 10 ++++++---- tests/phpunit/engine/{Types => Type}/IntegerTest.php | 10 ++++++---- .../engine/{Types => Type}/NonEmptyTextTest.php | 10 ++++++---- tests/phpunit/engine/{Types => Type}/TextTest.php | 8 +++++--- .../engine/{Types => Type}/UnsignedIntegerTest.php | 10 ++++++---- tests/phpunit/engine/{Types => Type}/UrlTest.php | 10 ++++++---- 15 files changed, 66 insertions(+), 37 deletions(-) rename tests/phpunit/engine/{Types => Type}/BooleanTest.php (82%) rename tests/phpunit/engine/{Types => Type}/DecimalTest.php (82%) rename tests/phpunit/engine/{Types => Type}/EmailTest.php (79%) rename tests/phpunit/engine/{Types => Type}/IntegerTest.php (78%) rename tests/phpunit/engine/{Types => Type}/NonEmptyTextTest.php (79%) rename tests/phpunit/engine/{Types => Type}/TextTest.php (82%) rename tests/phpunit/engine/{Types => Type}/UnsignedIntegerTest.php (79%) rename tests/phpunit/engine/{Types => Type}/UrlTest.php (79%) diff --git a/tests/phpunit/engine/Api/V1/AuthorizationTest.php b/tests/phpunit/engine/Api/V1/AuthorizationTest.php index 3d05cfe8..03bbb697 100644 --- a/tests/phpunit/engine/Api/V1/AuthorizationTest.php +++ b/tests/phpunit/engine/Api/V1/AuthorizationTest.php @@ -13,9 +13,10 @@ namespace EA\Engine\Api\V1; -use \EA\Engine\Types\NonEmptyText; +use EA\Engine\Type\NonEmptyText; +use PHPUnit\Framework\TestCase; -class AuthorizationTest extends \PHPUnit_Framework_TestCase { +class AuthorizationTest extends TestCase { public function testBasicMethodPerformsBasicAuthentication() { $this->markTestIncomplete(); diff --git a/tests/phpunit/engine/Api/V1/FilterTest.php b/tests/phpunit/engine/Api/V1/FilterTest.php index d0946a3f..5d5e4608 100644 --- a/tests/phpunit/engine/Api/V1/FilterTest.php +++ b/tests/phpunit/engine/Api/V1/FilterTest.php @@ -13,7 +13,9 @@ namespace EA\Engine\Api\V1; -class FilterTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class FilterTest extends TestCase { public function test() { $this->markTestIncomplete(); diff --git a/tests/phpunit/engine/Api/V1/MinimizeTest.php b/tests/phpunit/engine/Api/V1/MinimizeTest.php index a75ddbf6..6f384aab 100644 --- a/tests/phpunit/engine/Api/V1/MinimizeTest.php +++ b/tests/phpunit/engine/Api/V1/MinimizeTest.php @@ -13,7 +13,9 @@ namespace EA\Engine\Api\V1; -class MinimizeTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class MinimizeTest extends TestCase { public function test() { $this->markTestIncomplete(); diff --git a/tests/phpunit/engine/Api/V1/PaginationTest.php b/tests/phpunit/engine/Api/V1/PaginationTest.php index 67ff04ea..5f941752 100644 --- a/tests/phpunit/engine/Api/V1/PaginationTest.php +++ b/tests/phpunit/engine/Api/V1/PaginationTest.php @@ -13,7 +13,9 @@ namespace EA\Engine\Api\V1; -class PaginationTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class PaginationTest extends TestCase { public function test() { $this->markTestIncomplete(); diff --git a/tests/phpunit/engine/Api/V1/ResponseTest.php b/tests/phpunit/engine/Api/V1/ResponseTest.php index 4f984084..c7ed5c1a 100644 --- a/tests/phpunit/engine/Api/V1/ResponseTest.php +++ b/tests/phpunit/engine/Api/V1/ResponseTest.php @@ -13,7 +13,9 @@ namespace EA\Engine\Api\V1; -class ResponseTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class ResponseTest extends TestCase { public function test() { $this->markTestIncomplete(); diff --git a/tests/phpunit/engine/Api/V1/SearchTest.php b/tests/phpunit/engine/Api/V1/SearchTest.php index dcd80517..c87334ea 100644 --- a/tests/phpunit/engine/Api/V1/SearchTest.php +++ b/tests/phpunit/engine/Api/V1/SearchTest.php @@ -13,7 +13,9 @@ namespace EA\Engine\Api\V1; -class SearchTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class SearchTest extends TestCase { public function test() { $this->markTestIncomplete(); diff --git a/tests/phpunit/engine/Api/V1/SortTest.php b/tests/phpunit/engine/Api/V1/SortTest.php index 8b3694a4..317f86b2 100644 --- a/tests/phpunit/engine/Api/V1/SortTest.php +++ b/tests/phpunit/engine/Api/V1/SortTest.php @@ -13,7 +13,9 @@ namespace EA\Engine\Api\V1; -class SortTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class SortTest extends TestCase { public function test() { $this->markTestIncomplete(); diff --git a/tests/phpunit/engine/Types/BooleanTest.php b/tests/phpunit/engine/Type/BooleanTest.php similarity index 82% rename from tests/phpunit/engine/Types/BooleanTest.php rename to tests/phpunit/engine/Type/BooleanTest.php index 866b2a7f..b8b01f94 100644 --- a/tests/phpunit/engine/Types/BooleanTest.php +++ b/tests/phpunit/engine/Type/BooleanTest.php @@ -11,9 +11,11 @@ * @since v1.2.0 * ---------------------------------------------------------------------------- */ -namespace EA\Engine\Types; +namespace EA\Engine\Type; -class BooleanTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class BooleanTest extends TestCase { public function testBoolType() { $type = new Boolean(TRUE); @@ -22,7 +24,7 @@ class BooleanTest extends \PHPUnit_Framework_TestCase { public function testBoolTypeThrowsExceptionWithInvalidValue() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new Boolean(NULL); } } diff --git a/tests/phpunit/engine/Types/DecimalTest.php b/tests/phpunit/engine/Type/DecimalTest.php similarity index 82% rename from tests/phpunit/engine/Types/DecimalTest.php rename to tests/phpunit/engine/Type/DecimalTest.php index 2fccbfa8..ae9b726b 100644 --- a/tests/phpunit/engine/Types/DecimalTest.php +++ b/tests/phpunit/engine/Type/DecimalTest.php @@ -11,9 +11,11 @@ * @since v1.2.0 * ---------------------------------------------------------------------------- */ -namespace EA\Engine\Types; +namespace EA\Engine\Type; -class DecimalTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class DecimalTest extends TestCase { public function testFloatType() { $type = new Decimal(100.00); @@ -22,7 +24,7 @@ class DecimalTest extends \PHPUnit_Framework_TestCase { public function testFloatTypeThrowsExceptionWithInvalidValue() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new Decimal(NULL); } } diff --git a/tests/phpunit/engine/Types/EmailTest.php b/tests/phpunit/engine/Type/EmailTest.php similarity index 79% rename from tests/phpunit/engine/Types/EmailTest.php rename to tests/phpunit/engine/Type/EmailTest.php index d8abbed1..b82dbdfc 100644 --- a/tests/phpunit/engine/Types/EmailTest.php +++ b/tests/phpunit/engine/Type/EmailTest.php @@ -11,9 +11,11 @@ * @since v1.2.0 * ---------------------------------------------------------------------------- */ -namespace EA\Engine\Types; +namespace EA\Engine\Type; -class EmailTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class EmailTest extends TestCase { public function testEmailType() { $type = new Email('john@doe.com'); @@ -22,13 +24,13 @@ class EmailTest extends \PHPUnit_Framework_TestCase { public function testEmailTypeThrowsExceptionWithInvalidEmail() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new Email('abcdef'); } public function testEmailTypeThrowsExceptionWithInvalidValue() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new Email(NULL); } } diff --git a/tests/phpunit/engine/Types/IntegerTest.php b/tests/phpunit/engine/Type/IntegerTest.php similarity index 78% rename from tests/phpunit/engine/Types/IntegerTest.php rename to tests/phpunit/engine/Type/IntegerTest.php index be16d99e..dbcf0f31 100644 --- a/tests/phpunit/engine/Types/IntegerTest.php +++ b/tests/phpunit/engine/Type/IntegerTest.php @@ -11,9 +11,11 @@ * @since v1.2.0 * ---------------------------------------------------------------------------- */ -namespace EA\Engine\Types; +namespace EA\Engine\Type; -class IntegerTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class IntegerTest extends TestCase { public function testIntType() { $type = new Integer(1); @@ -22,13 +24,13 @@ class IntegerTest extends \PHPUnit_Framework_TestCase { public function testIntTypeThrowsExceptionWithFloat() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new Integer(100.00); } public function testIntTypeThrowsExceptionWithWithString() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new Integer('invalid'); } } diff --git a/tests/phpunit/engine/Types/NonEmptyTextTest.php b/tests/phpunit/engine/Type/NonEmptyTextTest.php similarity index 79% rename from tests/phpunit/engine/Types/NonEmptyTextTest.php rename to tests/phpunit/engine/Type/NonEmptyTextTest.php index 46002c0b..80ca1025 100644 --- a/tests/phpunit/engine/Types/NonEmptyTextTest.php +++ b/tests/phpunit/engine/Type/NonEmptyTextTest.php @@ -11,9 +11,11 @@ * @since v1.2.0 * ---------------------------------------------------------------------------- */ -namespace EA\Engine\Types; +namespace EA\Engine\Type; -class NonEmptyAlphanumericTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class NonEmptyTextTest extends TestCase { public function testNonEmptyStringType() { $type = new NonEmptyText('Hello!'); @@ -22,13 +24,13 @@ class NonEmptyAlphanumericTest extends \PHPUnit_Framework_TestCase { public function testNonEmptyStringTypeThrowsExceptionWithEmptyString() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new NonEmptyText(''); } public function testNonEmptyStringTypeThrowsExceptionWithInvalidValue() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new NonEmptyText(NULL); } } diff --git a/tests/phpunit/engine/Types/TextTest.php b/tests/phpunit/engine/Type/TextTest.php similarity index 82% rename from tests/phpunit/engine/Types/TextTest.php rename to tests/phpunit/engine/Type/TextTest.php index 588e0b2b..d24d20a2 100644 --- a/tests/phpunit/engine/Types/TextTest.php +++ b/tests/phpunit/engine/Type/TextTest.php @@ -11,9 +11,11 @@ * @since v1.2.0 * ---------------------------------------------------------------------------- */ -namespace EA\Engine\Types; +namespace EA\Engine\Type; -class TextTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class TextTest extends TestCase { public function testStringType() { $type = new Text('Hello!'); @@ -22,7 +24,7 @@ class TextTest extends \PHPUnit_Framework_TestCase { public function testStringTypeThrowsExceptionWithInvalidValue() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new Text(NULL); } } diff --git a/tests/phpunit/engine/Types/UnsignedIntegerTest.php b/tests/phpunit/engine/Type/UnsignedIntegerTest.php similarity index 79% rename from tests/phpunit/engine/Types/UnsignedIntegerTest.php rename to tests/phpunit/engine/Type/UnsignedIntegerTest.php index 4b287d0f..ec886774 100644 --- a/tests/phpunit/engine/Types/UnsignedIntegerTest.php +++ b/tests/phpunit/engine/Type/UnsignedIntegerTest.php @@ -11,9 +11,11 @@ * @since v1.2.0 * ---------------------------------------------------------------------------- */ -namespace EA\Engine\Types; +namespace EA\Engine\Type; -class UnsignedIntegerTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class UnsignedIntegerTest extends TestCase { public function testUnsignedIntType() { $type = new UnsignedInteger(1); @@ -22,13 +24,13 @@ class UnsignedIntegerTest extends \PHPUnit_Framework_TestCase { public function testUnsignedIntTypeThrowsExceptionWithNegative() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new UnsignedInteger(-1); } public function testUnsignedIntTypeThrowsExceptionWithWithString() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new UnsignedInteger('invalid'); } } diff --git a/tests/phpunit/engine/Types/UrlTest.php b/tests/phpunit/engine/Type/UrlTest.php similarity index 79% rename from tests/phpunit/engine/Types/UrlTest.php rename to tests/phpunit/engine/Type/UrlTest.php index 1e46254e..5c652bc5 100644 --- a/tests/phpunit/engine/Types/UrlTest.php +++ b/tests/phpunit/engine/Type/UrlTest.php @@ -11,9 +11,11 @@ * @since v1.2.0 * ---------------------------------------------------------------------------- */ -namespace EA\Engine\Types; +namespace EA\Engine\Type; -class UrlTest extends \PHPUnit_Framework_TestCase { +use PHPUnit\Framework\TestCase; + +class UrlTest extends TestCase { public function testUrlType() { $type = new Url('http://localhost'); @@ -22,13 +24,13 @@ class UrlTest extends \PHPUnit_Framework_TestCase { public function testUrlTypeThrowsExceptionWithInvalidUrl() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new Url('abcdef'); } public function testUrlTypeThrowsExceptionWithInvalidValue() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException(\InvalidArgumentException::class); new Url(NULL); } }