Skip to content

Commit e3a07de

Browse files
authored
Fix test failed in new PhpUnit (#2)
1 parent 76c4e45 commit e3a07de

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.github/workflows/phpunit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
- 7.3
2020
- 7.4
2121
- 8.0
22+
- 8.1
23+
- 8.2
24+
- 8.3
2225

2326
env:
2427
EXECUTE_COVERAGE: ${{ matrix.php-version == '8.0' }}

tests/TestCase.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@
44

55
class TestCase extends \Orchestra\Testbench\TestCase
66
{
7+
// Implement compatibility with new PhpUnit that requires first constructor argument.
8+
public function __construct($name = null)
9+
{
10+
parent::__construct($name ?? get_class($this));
11+
}
712
}

tests/Unit/CardTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@
1010

1111
class CardTest extends TestCase
1212
{
13-
/** @test @dataProvider badStrings **/
14-
public function it_expects_card_number($input)
13+
public function it_expects_card_number()
1514
{
1615
$this->expectException(CreditCardException::class);
17-
18-
Factory::makeFromNumber($input);
16+
Factory::makeFromNumber(null);
1917
}
2018

21-
public function badStrings()
19+
public function it_expects_not_empty_card_number()
2220
{
23-
return ['empty string' => [''], 'null' => [null]];
21+
$this->expectException(CreditCardException::class);
22+
Factory::makeFromNumber('');
2423
}
2524

2625
/** @test **/

0 commit comments

Comments
 (0)