Skip to content

Commit f2b8e6d

Browse files
authored
Merge pull request #30 from PUGX/phpunit-upgrade
👷 upgrade phpunit
2 parents 5ec54e8 + 08ac0d4 commit f2b8e6d

6 files changed

Lines changed: 38 additions & 38 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ $id5 = Shortid::generate(5);
7575
## More readable strings
7676

7777
Sometimes, you want to avoid some ambiguous characters, like `B`/`8` or `I`/`l` (uppercase/lowercase).
78-
In this case, you can pass a third parameter `true` to `generate` method. Notice that in this case the alphabet
78+
In this case, you can pass a third parameter `true` to the `generate` method. Notice that in this case the alphabet
7979
will be ignored, so it makes sense to pass a null one.
8080

8181
Example:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"symfony/polyfill-mbstring": "^1.19"
2626
},
2727
"require-dev": {
28-
"dg/bypass-finals": "^1.3",
29-
"phpunit/phpunit": "^9.6"
28+
"dg/bypass-finals": "^1.9",
29+
"phpunit/phpunit": "^10.5 || ^11.5 || ^12.1"
3030
},
3131
"config": {
3232
"bin-dir": "bin"

phpunit.xml.dist

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.0/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
backupGlobals="false"
55
colors="true"
6-
convertDeprecationsToExceptions="false"
7-
convertWarningsToExceptions="false"
86
bootstrap="vendor/autoload.php"
97
>
108
<testsuites>
119
<testsuite name="ShortId Test Suite">
1210
<directory>tests</directory>
1311
</testsuite>
1412
</testsuites>
15-
<filter>
16-
<whitelist>
17-
<directory suffix=".php">src/</directory>
18-
</whitelist>
19-
</filter>
13+
<source>
14+
<include>
15+
<directory>src</directory>
16+
</include>
17+
</source>
2018
<logging>
21-
<log type="tap" target="build/report.tap"/>
22-
<log type="junit" target="build/report.junit.xml"/>
23-
<log type="coverage-html" target="build/coverage"/>
24-
<log type="coverage-text" target="build/coverage.txt"/>
25-
<log type="coverage-clover" target="build/logs/clover.xml"/>
19+
<junit outputFile="build/report.junit.xml"/>
2620
</logging>
27-
<!-- see https://www.tomasvotruba.cz/blog/2019/03/28/how-to-mock-final-classes-in-phpunit/ -->
21+
<coverage>
22+
<report>
23+
<clover outputFile="build/logs/clover.xml"/>
24+
<html outputDirectory="build/coverage"/>
25+
<text outputFile="build/coverage.txt"/>
26+
</report>
27+
</coverage>
2828
<extensions>
29-
<extension class="PUGX\Shortid\Test\BypassFinalHook"/>
29+
<bootstrap class="PUGX\Shortid\Test\BypassFinalExtension"/>
3030
</extensions>
3131
</phpunit>

tests/BypassFinalExtension.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace PUGX\Shortid\Test;
4+
5+
use DG\BypassFinals;
6+
use PHPUnit\Runner\Extension\Extension;
7+
use PHPUnit\Runner\Extension\Facade;
8+
use PHPUnit\Runner\Extension\ParameterCollection;
9+
use PHPUnit\TextUI\Configuration\Configuration;
10+
11+
final class BypassFinalExtension implements Extension
12+
{
13+
public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters): void
14+
{
15+
BypassFinals::enable();
16+
}
17+
}

tests/BypassFinalHook.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/FactoryTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PUGX\Shortid\Test;
44

5+
use PHPUnit\Framework\Attributes\DataProvider;
56
use PHPUnit\Framework\TestCase;
67
use PUGX\Shortid\Factory;
78
use RandomLib\Factory as RandomLibFactory;
@@ -49,9 +50,7 @@ public static function alphabetsProvider(): array
4950
return $alphabets;
5051
}
5152

52-
/**
53-
* @dataProvider alphabetsProvider
54-
*/
53+
#[DataProvider('alphabetsProvider')]
5554
public function testSetAlphabet(string $alphabet): void
5655
{
5756
$this->factory->setAlphabet($alphabet);
@@ -61,9 +60,7 @@ public function testSetAlphabet(string $alphabet): void
6160
self::assertSame($alphabet, $newAlphabet);
6261
}
6362

64-
/**
65-
* @dataProvider wrongAlphabetsProvider
66-
*/
63+
#[DataProvider('wrongAlphabetsProvider')]
6764
public function testSetWrongAlphabet(string $alphabet): void
6865
{
6966
$this->expectException(\InvalidArgumentException::class);

0 commit comments

Comments
 (0)