From 950cff1f5a65c85945dff12244d3470c2586a05f Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Wed, 21 Aug 2019 22:55:40 +0200 Subject: [PATCH] Use PHPUnit 5 --- Makefile | 25 +++++++++++++++++++------ phpunit.xml.dist | 26 +++++++++++--------------- tests/DateTimeTest.php | 5 +++-- tests/TimeZoneLocationTest.php | 5 +++-- tests/TimeZoneTest.php | 5 +++-- tests/bootstrap.php | 12 ------------ 6 files changed, 39 insertions(+), 39 deletions(-) delete mode 100644 tests/bootstrap.php diff --git a/Makefile b/Makefile index 1b73a4a..47fd4c5 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,14 @@ PACKAGE_NAME = ICanBoogie/DateTime PACKAGE_VERSION = v1.2 +PHPUNIT_VERSION = phpunit-5.7.phar +PHPUNIT_FILENAME = build/$(PHPUNIT_VERSION) +PHPUNIT = php $(PHPUNIT_FILENAME) # do not edit the following lines +all: $(PHPUNIT_FILENAME) vendor + usage: @echo "test: Runs the test suite.\ndoc: Creates the documentation.\nclean: Removes the documentation, the dependencies and the Composer files." @@ -17,17 +22,23 @@ update: autoload: vendor @composer dump-autoload -test: vendor - @phpunit +test-dependencies: $(PHPUNIT_FILENAME) vendor + +$(PHPUNIT_FILENAME): + mkdir -p build + wget https://phar.phpunit.de/$(PHPUNIT_VERSION) -O $(PHPUNIT_FILENAME) -test-coverage: vendor +test: test-dependencies + @$(PHPUNIT) + +test-coverage: test-dependencies @mkdir -p build/coverage - @phpunit --coverage-html build/coverage + @$(PHPUNIT) --coverage-html build/coverage -test-coveralls: vendor +test-coveralls: test-dependencies @mkdir -p build/logs composer require --dev php-coveralls/php-coveralls - @phpunit --coverage-clover build/logs/clover.xml + @$(PHPUNIT) --coverage-clover build/logs/clover.xml php vendor/bin/php-coveralls -v doc: vendor @@ -42,3 +53,5 @@ clean: @rm -fR build @rm -fR vendor @rm -f composer.lock + +.PHONY: all autoload doc clean test test-coverage test-coveralls update diff --git a/phpunit.xml.dist b/phpunit.xml.dist index aaef031..18113bc 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,21 +1,17 @@ - - - - ./tests - - + + + ./tests + + diff --git a/tests/DateTimeTest.php b/tests/DateTimeTest.php index 863d650..257b02c 100644 --- a/tests/DateTimeTest.php +++ b/tests/DateTimeTest.php @@ -9,12 +9,13 @@ * file that was distributed with this source code. */ -namespace Tests\ICanBoogie\Time; +namespace Tests\ICanBoogie; use ICanBoogie\DateTime; use ICanBoogie\DateTimeTest\MyDateTime; +use PHPUnit\Framework\TestCase; -class DateTimeTest extends \PHPUnit_Framework_TestCase +class DateTimeTest extends TestCase { public function setUp() { diff --git a/tests/TimeZoneLocationTest.php b/tests/TimeZoneLocationTest.php index e280cd7..4e5875d 100644 --- a/tests/TimeZoneLocationTest.php +++ b/tests/TimeZoneLocationTest.php @@ -9,11 +9,12 @@ * file that was distributed with this source code. */ -namespace Tests\ICanBoogie\Time; +namespace Tests\ICanBoogie; use ICanBoogie\TimeZoneLocation; +use PHPUnit\Framework\TestCase; -class TimeZoneLocationTest extends \PHPUnit_Framework_TestCase +class TimeZoneLocationTest extends TestCase { public function test_from() { diff --git a/tests/TimeZoneTest.php b/tests/TimeZoneTest.php index 8e4d5e2..07312d1 100644 --- a/tests/TimeZoneTest.php +++ b/tests/TimeZoneTest.php @@ -9,11 +9,12 @@ * file that was distributed with this source code. */ -namespace Tests\ICanBoogie\Time; +namespace Tests\ICanBoogie; use ICanBoogie\TimeZone; +use PHPUnit\Framework\TestCase; -class TimeZoneTest extends \PHPUnit_Framework_TestCase +class TimeZoneTest extends TestCase { public function test_get_location() { diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index b48ae1c..0000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,12 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require __DIR__ . '/../vendor/autoload.php'; \ No newline at end of file