Skip to content

Commit

Permalink
Merge pull request #33 from chrisryan/master
Browse files Browse the repository at this point in the history
Add Support for PHP 8
  • Loading branch information
chadicus committed May 22, 2023
2 parents 5cc352b + 83bdb92 commit 114bd19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 28 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-latest
strategy:
matrix:
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4']
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
},
"license": "MIT",
"require": {
"php": "^7.0"
"php": "^7.0||^8.0"
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"phpunit/phpunit": ">=6.5",
"squizlabs/php_codesniffer": "^3.3"
},
"autoload": {
Expand Down
36 changes: 11 additions & 25 deletions tests/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@
*/
final class ReaderTest extends TestCase
{
private $unreadableFilePath;

public function setUp()
{
$this->unreadableFilePath = tempnam(sys_get_temp_dir(), 'csv');
touch($this->unreadableFilePath);
chmod($this->unreadableFilePath, 0220);
}

public function tearDown()
{
unlink($this->unreadableFilePath);
}

/**
* Verify basic usage of Reader.
*
Expand Down Expand Up @@ -85,7 +71,7 @@ public function basicUsage(Reader $reader)
*
* @return array
*/
public function getReaders()
public static function getReaders()
{
$headers = ['id', 'author', 'title', 'genre', 'price', 'publish_date', 'description'];
return [
Expand All @@ -104,14 +90,14 @@ public function getReaders()
*
* @test
* @covers ::__construct
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage $file must be a string containing a full path to a readable delimited file
* @dataProvider getFiles
*
* @return void
*/
public function constructInvalidFileParam($file)
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$file must be a string containing a full path to a readable delimited file');
$reader = new Reader($file);
}

Expand All @@ -120,7 +106,7 @@ public function constructInvalidFileParam($file)
*
* @return array
*/
public function getFiles()
public static function getFiles()
{
return [
[__DIR__ . '/_files/not_readable.csv'],
Expand All @@ -135,13 +121,13 @@ public function getFiles()
*
* @test
* @covers ::__construct
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage $delimiter must be a single character string
*
* @return void
*/
public function constructInvalidDelimiter()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$delimiter must be a single character string');
new Reader(__DIR__ . '/_files/basic.csv', null, 'too long');
}

Expand All @@ -150,13 +136,13 @@ public function constructInvalidDelimiter()
*
* @test
* @covers ::__construct
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage $enclosure must be a single character string
*
* @return void
*/
public function constructInvalidEnclosure()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$enclosure must be a single character string');
new Reader(__DIR__ . '/_files/basic.csv', null, ',', 123);
}

Expand All @@ -165,13 +151,13 @@ public function constructInvalidEnclosure()
*
* @test
* @covers ::__construct
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage $escapeChar must be a single character string
*
* @return void
*/
public function constructInvalidEscapeChar()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$escapeChar must be a single character string');
new Reader(__DIR__ . '/_files/basic.csv', null, ',', '"', null);
}

Expand Down Expand Up @@ -254,7 +240,7 @@ public function emptyFiles(Reader $reader)
*
* @return array
*/
public function getEmptyFiles()
public static function getEmptyFiles()
{
$headers = ['id', 'author', 'title', 'genre', 'price', 'publish_date', 'description'];
return [
Expand Down

0 comments on commit 114bd19

Please sign in to comment.