diff --git a/.travis.yml b/.travis.yml index e4f850e..0b462f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: php php: - - '7.1' - - '7.2' + - '7.3' + - '7.4' + - '8.0' - hhvm matrix: @@ -16,7 +17,7 @@ install: - php composer.phar install --no-interaction script: - - php vendor/bin/phpunit -c phpunit.xml + - XDEBUG_MODE=coverage php vendor/bin/phpunit -c phpunit.xml --coverage-clover clover.xml after_success: - - travis_retry php vendor/bin/coveralls -v + - travis_retry php vendor/bin/php-coveralls -v diff --git a/composer.json b/composer.json index 8eb3955..b848b9f 100644 --- a/composer.json +++ b/composer.json @@ -17,12 +17,12 @@ ], "minimum-stability": "dev", "require": { - "php": "^7.1", + "php": "^7.3 || ^8.0", "dragonmantank/cron-expression": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5.7", - "satooshi/php-coveralls": "^1.0", + "phpunit/phpunit": "~9.5", + "php-coveralls/php-coveralls": "^2.4", "swiftmailer/swiftmailer": "~5.4 || ^6.0" }, "suggest": { diff --git a/phpunit.xml b/phpunit.xml index b16eaf9..c29142a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,28 +1,20 @@ - - - - ./tests/ - - - - - - - - src/GO - - - - - + + + + src/GO + + + + + + + + ./tests/ + + + + + + diff --git a/tests/GO/IntervalTest.php b/tests/GO/IntervalTest.php index 24c1d42..9519a73 100644 --- a/tests/GO/IntervalTest.php +++ b/tests/GO/IntervalTest.php @@ -32,11 +32,10 @@ public function testShouldRunHourlyWithCustomInput() $this->assertTrue($job->hourly(19)->isDue(\DateTime::createFromFormat('H:i', '11:19'))); } - /** - * @expectedException InvalidArgumentException - */ public function testShouldThrowExceptionWithInvalidHourlyMinuteInput() { + $this->expectException(\InvalidArgumentException::class); + $job = new Job('ls'); $job->hourly('abc'); } @@ -63,20 +62,18 @@ public function testShouldRunDailyWithCustomInput() $this->assertTrue($job->daily('19:53')->isDue(\DateTime::createFromFormat('H:i', '19:53'))); } - /** - * @expectedException InvalidArgumentException - */ public function testShouldThrowExceptionWithInvalidDailyHourInput() { + $this->expectException(\InvalidArgumentException::class); + $job = new Job('ls'); $job->daily('abc'); } - /** - * @expectedException InvalidArgumentException - */ public function testShouldThrowExceptionWithInvalidDailyMinuteInput() { + $this->expectException(\InvalidArgumentException::class); + $job = new Job('ls'); $job->daily(2, 'abc'); } diff --git a/tests/GO/JobTest.php b/tests/GO/JobTest.php index 8d52bc0..1b84cb2 100644 --- a/tests/GO/JobTest.php +++ b/tests/GO/JobTest.php @@ -141,11 +141,10 @@ public function testShouldAcceptSingleOrMultipleEmails() $this->assertInstanceOf(Job::class, $job->email(['test@mail.com', 'other@mail.com'])); } - /** - * @expectedException InvalidArgumentException - */ public function testShouldFailIfEmailInputIsNotStringOrArray() { + $this->expectException(\InvalidArgumentException::class); + $job = new Job('ls'); $job->email(1); @@ -159,11 +158,10 @@ public function testShouldAcceptEmailConfigurationAndItShouldBeChainable() ])); } - /** - * @expectedException InvalidArgumentException - */ public function testShouldFailIfEmailConfigurationIsNotArray() { + $this->expectException(\InvalidArgumentException::class); + $job = new Job('ls'); $job->configure([ 'email' => 123, diff --git a/tests/GO/SchedulerTest.php b/tests/GO/SchedulerTest.php index 2b1717c..9f2204d 100644 --- a/tests/GO/SchedulerTest.php +++ b/tests/GO/SchedulerTest.php @@ -62,11 +62,10 @@ public function testShouldUseSystemPhpBinIfCustomBinDoesNotExist() $this->assertEquals(PHP_BINARY . ' ' . $script, $job->compile()); } - /** - * @expectedException InvalidArgumentException - */ public function testShouldThrowExceptionIfScriptIsNotAString() { + $this->expectException(\InvalidArgumentException::class); + $scheduler = new Scheduler(); $scheduler->php(function () { return false; @@ -234,8 +233,8 @@ public function testShouldShowClosuresVerboseOutputAsText() $scheduler->run(); - $this->assertRegexp('/ Executing Closure$/', $scheduler->getVerboseOutput()); - $this->assertRegexp('/ Executing Closure$/', $scheduler->getVerboseOutput('text')); + $this->assertMatchesRegularExpression('/ Executing Closure$/', $scheduler->getVerboseOutput()); + $this->assertMatchesRegularExpression('/ Executing Closure$/', $scheduler->getVerboseOutput('text')); } public function testShouldShowClosuresVerboseOutputAsHtml() @@ -254,7 +253,7 @@ public function testShouldShowClosuresVerboseOutputAsHtml() $scheduler->run(); - $this->assertRegexp('/
/', $scheduler->getVerboseOutput('html')); + $this->assertMatchesRegularExpression('/
/', $scheduler->getVerboseOutput('html')); } public function testShouldShowClosuresVerboseOutputAsArray() @@ -277,11 +276,10 @@ public function testShouldShowClosuresVerboseOutputAsArray() $this->assertEquals(count($scheduler->getVerboseOutput('array')), 2); } - /** - * @expectedException InvalidArgumentException - */ public function testShouldThrowExceptionWithInvalidOutputType() { + $this->expectException(\InvalidArgumentException::class); + $scheduler = new Scheduler(); $scheduler->call(function ($phrase) {