Skip to content

Commit

Permalink
Added php 8.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroTroller committed Jan 25, 2021
1 parent 78bfb26 commit 39fb3ad
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 57 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: php
php:
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- hhvm

matrix:
Expand All @@ -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
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
44 changes: 18 additions & 26 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Scheduler Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
</php>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory>src/GO</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="clover.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="./vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory>src/GO</directory>
</include>
<report>
<clover outputFile="clover.xml"/>
</report>
</coverage>
<testsuites>
<testsuite name="Scheduler Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
</php>
<logging/>
</phpunit>
15 changes: 6 additions & 9 deletions tests/GO/IntervalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -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');
}
Expand Down
10 changes: 4 additions & 6 deletions tests/GO/JobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,10 @@ public function testShouldAcceptSingleOrMultipleEmails()
$this->assertInstanceOf(Job::class, $job->email(['[email protected]', '[email protected]']));
}

/**
* @expectedException InvalidArgumentException
*/
public function testShouldFailIfEmailInputIsNotStringOrArray()
{
$this->expectException(\InvalidArgumentException::class);

$job = new Job('ls');

$job->email(1);
Expand All @@ -159,11 +158,10 @@ public function testShouldAcceptEmailConfigurationAndItShouldBeChainable()
]));
}

/**
* @expectedException InvalidArgumentException
*/
public function testShouldFailIfEmailConfigurationIsNotArray()
{
$this->expectException(\InvalidArgumentException::class);

$job = new Job('ls');
$job->configure([
'email' => 123,
Expand Down
16 changes: 7 additions & 9 deletions tests/GO/SchedulerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand All @@ -254,7 +253,7 @@ public function testShouldShowClosuresVerboseOutputAsHtml()

$scheduler->run();

$this->assertRegexp('/<br>/', $scheduler->getVerboseOutput('html'));
$this->assertMatchesRegularExpression('/<br>/', $scheduler->getVerboseOutput('html'));
}

public function testShouldShowClosuresVerboseOutputAsArray()
Expand All @@ -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) {
Expand Down

0 comments on commit 39fb3ad

Please sign in to comment.