Skip to content

Commit

Permalink
Merge pull request #5 from chrisryan/master
Browse files Browse the repository at this point in the history
Add Support for PHP 8.
  • Loading branch information
chrisryan authored Sep 27, 2022
2 parents 2fc7b8f + f529727 commit b0ce399
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-18.04
strategy:
matrix:
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4']
php-versions: ['7.3', '7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
},
"license": "MIT",
"require": {
"php": "^7.0",
"traderinteractive/exceptions": "^1.0"
"php": "^7.3 || ^8.0",
"traderinteractive/exceptions": "^2.0"
},
"suggest": {
"ext-timezonedb": "The latest version of the timezone database"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"phpunit/phpunit": "^9.0",
"squizlabs/php_codesniffer": "^3.2"
},
"autoload": {
Expand Down
17 changes: 8 additions & 9 deletions tests/DateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public function filterTimestamp()
*
* @test
* @covers ::filter
* @expectedException \TraderInteractive\Exceptions\FilterException
* @expectedExceptionMessage $value is not a non-empty string
*
* @return void
*/
public function filterEmptyValue()
{
$this->expectException(\TraderInteractive\Exceptions\FilterException::class);
$this->expectExceptionMessage('$value is not a non-empty string');
DateTime::filter("\t \n");
}

Expand All @@ -64,13 +64,13 @@ public function filterEmptyValue()
*
* @test
* @covers ::filter
* @expectedException \TraderInteractive\Exceptions\FilterException
* @expectedExceptionMessage $value is not a non-empty string
*
* @return void
*/
public function filterInvalidValue()
{
$this->expectException(\TraderInteractive\Exceptions\FilterException::class);
$this->expectExceptionMessage('$value is not a non-empty string');
DateTime::filter(true);
}

Expand All @@ -90,11 +90,11 @@ public function filterNullAllowed()
*
* @test
* @covers ::filter
* @expectedException \TraderInteractive\Exceptions\FilterException
* @expectedExceptionMessage Value failed filtering, $allowNull is set to false
*/
public function filterNullNotAllowed()
{
$this->expectException(\TraderInteractive\Exceptions\FilterException::class);
$this->expectExceptionMessage('Value failed filtering, $allowNull is set to false');
DateTime::filter(null, false);
}

Expand Down Expand Up @@ -154,12 +154,11 @@ public function format()
*
* @test
* @covers ::format
*
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage $format is not a non-empty string
*/
public function formatWithEmptyFormat()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$format is not a non-empty string');
$now = new \DateTime();
$this->assertSame($now->format('Y-m-d H:i:s'), DateTime::format($now, ' '));
}
Expand Down
16 changes: 8 additions & 8 deletions tests/DateTimeZoneTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public function filterNullAllowed()
*
* @test
* @covers ::filter
* @expectedException \TraderInteractive\Exceptions\FilterException
* @expectedExceptionMessage Value failed filtering, $allowNull is set to false
*
* @return void
*/
public function filterNullNotAllowed()
{
$this->expectException(\TraderInteractive\Exceptions\FilterException::class);
$this->expectExceptionMessage('Value failed filtering, $allowNull is set to false');
$this->assertNull(DateTimeZone::filter(null, false));
}

Expand All @@ -75,11 +75,11 @@ public function filterTimeZonePass()
*
* @test
* @covers ::filter
* @expectedException \TraderInteractive\Exceptions\FilterException
* @expectedExceptionMessage Unknown or bad timezone (INVALID)
*/
public function filterInvalidName()
{
$this->expectException(\TraderInteractive\Exceptions\FilterException::class);
$this->expectExceptionMessage('Unknown or bad timezone (INVALID)');
DateTimeZone::filter('INVALID');
}

Expand All @@ -88,13 +88,13 @@ public function filterInvalidName()
*
* @test
* @covers ::filter
* @expectedException \TraderInteractive\Exceptions\FilterException
* @expectedExceptionMessage $value not a non-empty string
*
* @return void
*/
public function filterEmptyValue()
{
$this->expectException(\TraderInteractive\Exceptions\FilterException::class);
$this->expectExceptionMessage('$value not a non-empty string');
DateTimeZone::filter("\n\t");
}

Expand All @@ -103,13 +103,13 @@ public function filterEmptyValue()
*
* @test
* @covers ::filter
* @expectedException \TraderInteractive\Exceptions\FilterException
* @expectedExceptionMessage $value not a non-empty string
*
* @return void
*/
public function filterNonStringArgument()
{
$this->expectException(\TraderInteractive\Exceptions\FilterException::class);
$this->expectExceptionMessage('$value not a non-empty string');
DateTimeZone::filter(42);
}
}

0 comments on commit b0ce399

Please sign in to comment.