Skip to content

Commit c0de9a2

Browse files
committed
2025 modernization
1 parent 8f1fd53 commit c0de9a2

File tree

6 files changed

+28
-25
lines changed

6 files changed

+28
-25
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
composer.lock
22
composer.phar
33
/vendor/
4-
.phpunit.result.cache
4+
.phpunit.cache/
55
/bin/

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ TestCase examples
4141

4242
If you run `php bin/phpunit` you will see the following output.
4343

44-
PHPUnit 9.5.20
45-
46-
... 3 / 3 (100%)
47-
48-
Time: 00:00.003, Memory: 6.00 MB
49-
50-
OK (3 tests, 3 assertions)
44+
PHPUnit 12.5-dev by Sebastian Bergmann and contributors.
45+
46+
.... 4 / 4 (100%)
47+
48+
Time: 00:00.002, Memory: 16.00 MB
49+
50+
OK (4 tests, 4 assertions)
5151

5252
That's because you will find one class and its TestCase in the project
5353
in order to help you. You can delete them.

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
"keywords": ["kata", "TDD"],
55
"homepage": "https://github.com/carlosbuenosvinos/php-kata",
66
"type": "library",
7+
"require": {
8+
"php": "^8.2"
9+
},
710
"require-dev": {
8-
"phpunit/phpunit": "^9.5",
9-
"mockery/mockery": "^1.5",
10-
"phpspec/phpspec": "^7.0"
11+
"phpunit/phpunit": "^12.5",
12+
"mockery/mockery": "^1.6",
13+
"phpspec/phpspec": "^8.0"
1114
},
1215
"license": "MIT",
1316
"authors": [

phpunit.xml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
5-
colors="true">
6-
<php>
7-
<ini name="intl.default_locale" value="en"/>
8-
<ini name="intl.error_level" value="0"/>
9-
<ini name="memory_limit" value="-1"/>
10-
</php>
11-
5+
colors="true"
6+
cacheDirectory=".phpunit.cache"
7+
>
128
<testsuites>
139
<testsuite name="Kata Test Suite">
1410
<directory>./tests/</directory>
1511
</testsuite>
1612
</testsuites>
1713

18-
<coverage processUncoveredFiles="true">
14+
<source>
1915
<include>
2016
<directory suffix=".php">./src</directory>
2117
</include>
22-
</coverage>
18+
</source>
2319
</phpunit>

src/Adder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Kata;
46

57
class Adder

tests/AdderTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Kata\Tests;
46

57
use Kata\Adder;
8+
use PHPUnit\Framework\Attributes\DataProvider;
69
use PHPUnit\Framework\TestCase;
710

811
class AdderTest extends TestCase
912
{
10-
/**
11-
* @dataProvider validSumsProvider
12-
*/
13+
#[DataProvider('validSumsProvider')]
1314
public function testValidSums(?int $a, ?int $b, int $expectedResult): void
1415
{
1516
$this->assertEquals(
@@ -18,12 +19,13 @@ public function testValidSums(?int $a, ?int $b, int $expectedResult): void
1819
);
1920
}
2021

21-
public function validSumsProvider(): array
22+
public static function validSumsProvider(): array
2223
{
2324
return [
2425
[null, null, 0],
2526
[0, 0, 0],
26-
[1, 1, 2]
27+
[1, 1, 2],
28+
[-4, -2, -6],
2729
];
2830
}
2931
}

0 commit comments

Comments
 (0)