Skip to content

Commit e4091aa

Browse files
committed
Fixed tests + updated actions
1 parent 7789532 commit e4091aa

File tree

10 files changed

+69
-41
lines changed

10 files changed

+69
-41
lines changed

.github/workflows/quality.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v3
8+
- uses: shivammathur/setup-php@v2
9+
with:
10+
php-version: '8.2'
11+
coverage: none
812
- name: Cs-Fixer
913
run: |
1014
wget -q https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer
@@ -33,7 +37,7 @@ jobs:
3337
php_version: '8.2'
3438
php_extensions: zip xdebug
3539
- name: Run tests & generate Coverage
36-
run: bin/phpunit --configuration=phpunit.xml tests --coverage-html var/coverage --whitelist=src
40+
run: bin/phpunit --coverage-html var/coverage
3741
- name: Store coverage files
3842
uses: actions/upload-artifact@v3
3943
with:
@@ -53,7 +57,6 @@ jobs:
5357
with:
5458
args: --prefer-dist
5559
php_version: '8.2'
56-
php_extensions: zip xdebug
5760
- name: PHPStan
5861
uses: php-actions/phpstan@v3
5962
with:

phpunit.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<?xml version="1.0"?>
2-
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
5-
backupGlobals="true"
6-
colors="false"
7-
processIsolation="false"
8-
stopOnError="false"
9-
stopOnFailure="false"
10-
stopOnIncomplete="false"
11-
stopOnSkipped="false"
12-
stopOnRisky="false"
13-
timeoutForSmallTests="1"
14-
timeoutForMediumTests="10"
15-
timeoutForLargeTests="60"
16-
verbose="false">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
4+
backupGlobals="true"
5+
colors="false"
6+
processIsolation="false"
7+
stopOnError="false"
8+
stopOnFailure="false"
9+
stopOnIncomplete="false"
10+
stopOnSkipped="false"
11+
stopOnRisky="false"
12+
timeoutForSmallTests="1"
13+
timeoutForMediumTests="10"
14+
timeoutForLargeTests="60"
15+
cacheDirectory=".phpunit.cache"
16+
>
1717
<testsuites>
1818
<testsuite name="Functional tests">
1919
<directory>tests/functional/</directory>
2020
</testsuite>
2121
</testsuites>
2222
<php>
23-
<ini name="allow_url_include" value="1" />
23+
<ini name="allow_url_include" value="1"/>
2424
</php>
2525
</phpunit>

src/CSV/FingersCrossed/Extractor.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
use Psr\Log\LoggerInterface;
1212
use Psr\Log\NullLogger;
1313

14-
class Extractor implements ExtractorInterface
14+
readonly class Extractor implements ExtractorInterface
1515
{
16-
public function __construct(private readonly ReaderInterface $reader, private readonly int $skipLines = 0, private readonly LoggerInterface $logger = new NullLogger())
17-
{
16+
public function __construct(
17+
private ReaderInterface $reader,
18+
private int $skipLines = 0,
19+
private LoggerInterface $logger = new NullLogger()
20+
) {
1821
}
1922

2023
public function extract(): iterable

src/CSV/FingersCrossed/Loader.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
use Psr\Log\LoggerInterface;
1616
use Psr\Log\NullLogger;
1717

18-
class Loader implements LoaderInterface, FlushableInterface
18+
readonly class Loader implements LoaderInterface, FlushableInterface
1919
{
20-
public function __construct(private readonly WriterInterface $writer, private readonly LoggerInterface $logger = new NullLogger())
21-
{
20+
public function __construct(
21+
private WriterInterface $writer,
22+
private LoggerInterface $logger = new NullLogger()
23+
) {
2224
}
2325

2426
public function load(): \Generator

src/CSV/Safe/Extractor.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
use Psr\Log\LoggerInterface;
1212
use Psr\Log\NullLogger;
1313

14-
class Extractor implements ExtractorInterface
14+
readonly class Extractor implements ExtractorInterface
1515
{
16-
public function __construct(private readonly ReaderInterface $reader, private readonly int $skipLines = 0, private readonly LoggerInterface $logger = new NullLogger())
17-
{
16+
public function __construct(
17+
private ReaderInterface $reader,
18+
private int $skipLines = 0,
19+
private LoggerInterface $logger = new NullLogger()
20+
) {
1821
}
1922

2023
public function extract(): iterable

src/CSV/Safe/Loader.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
use Psr\Log\LoggerInterface;
1616
use Psr\Log\NullLogger;
1717

18-
class Loader implements LoaderInterface, FlushableInterface
18+
readonly class Loader implements LoaderInterface, FlushableInterface
1919
{
20-
public function __construct(private readonly WriterInterface $writer, private readonly LoggerInterface $logger = new NullLogger())
21-
{
20+
public function __construct(
21+
private WriterInterface $writer,
22+
private LoggerInterface $logger = new NullLogger()
23+
) {
2224
}
2325

2426
public function load(): \Generator

src/Sheet/FingersCrossed/Extractor.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313
use Psr\Log\LoggerInterface;
1414
use Psr\Log\NullLogger;
1515

16-
class Extractor implements ExtractorInterface
16+
readonly class Extractor implements ExtractorInterface
1717
{
18-
public function __construct(private readonly ReaderInterface $reader, private readonly string $sheetName, private readonly int $skipLines = 0, private readonly LoggerInterface $logger = new NullLogger())
19-
{
18+
public function __construct(
19+
private ReaderInterface $reader,
20+
private string $sheetName,
21+
private int $skipLines = 0,
22+
private LoggerInterface $logger = new NullLogger()
23+
) {
2024
}
2125

2226
public function extract(): iterable

src/Sheet/Safe/Extractor.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313
use Psr\Log\LoggerInterface;
1414
use Psr\Log\NullLogger;
1515

16-
class Extractor implements ExtractorInterface
16+
readonly class Extractor implements ExtractorInterface
1717
{
18-
public function __construct(private readonly ReaderInterface $reader, private readonly string $sheetName, private readonly int $skipLines = 0, private readonly LoggerInterface $logger = new NullLogger())
19-
{
18+
public function __construct(
19+
private ReaderInterface $reader,
20+
private string $sheetName,
21+
private int $skipLines = 0,
22+
private LoggerInterface $logger = new NullLogger()
23+
) {
2024
}
2125

2226
public function extract(): iterable

tests/functional/CSV/FingersCrossed/LoaderTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ protected function tearDown(): void
4747
*/
4848
public function loadCsvSuccessful(): void
4949
{
50-
$this->writer->openToFile('vfs://test.csv');
50+
$path = tempnam(sys_get_temp_dir(), 'csv_');
51+
52+
$this->writer->openToFile($path);
5153

5254
$this->assertLoaderLoadsLike(
5355
[

tests/functional/CSV/Safe/LoaderTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use org\bovigo\vfs\vfsStreamDirectory;
1515
use org\bovigo\vfs\vfsStreamWrapper;
1616
use PHPUnit\Framework\TestCase;
17+
use Psr\Log\NullLogger;
1718

1819
/**
1920
* @internal
@@ -47,7 +48,9 @@ protected function tearDown(): void
4748
*/
4849
public function loadCsvSuccessful(): void
4950
{
50-
$this->writer->openToFile('vfs://test.csv');
51+
$path = tempnam(sys_get_temp_dir(), 'csv');
52+
53+
$this->writer->openToFile($path);
5154

5255
$this->assertLoaderLoadsLike(
5356
[
@@ -79,7 +82,9 @@ public function loadCsvSuccessful(): void
7982
*/
8083
public function loadCsvWithLogger(): void
8184
{
82-
$this->writer->openToFile('vfs://test.csv');
85+
$path = tempnam(sys_get_temp_dir(), 'csv');
86+
87+
$this->writer->openToFile($path);
8388

8489
$this->assertLoaderLoadsLike(
8590
[
@@ -102,10 +107,10 @@ public function loadCsvWithLogger(): void
102107
'last name' => 'dupont',
103108
],
104109
],
105-
new Loader($this->writer, new TestLogger())
110+
new Loader($this->writer, new NullLogger())
106111
);
107112

108-
$this->assertFileEquals(__DIR__.'/../data/users.csv', 'vfs://test.csv');
113+
$this->assertFileEquals(__DIR__.'/../data/users.csv', $path);
109114
}
110115

111116
public function pipelineRunner(): PipelineRunnerInterface

0 commit comments

Comments
 (0)