Skip to content

Commit cf4e5a7

Browse files
committed
:octocat: added phpunit constant to limit reader test maximum version
1 parent 6c66d56 commit cf4e5a7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

phpunit.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,7 @@
3333
<php>
3434
<!-- whether the test runs on CI - set to false to allow debug output -->
3535
<const name="TEST_IS_CI" value="true"/>
36+
<!-- limit the maximum version for the reader test to speed up things -->
37+
<const name="READER_TEST_MAX_VERSION" value="40"/>
3638
</php>
3739
</phpunit>

tests/QRCodeReaderTestAbstract.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use chillerlan\Settings\SettingsContainerInterface;
2020
use PHPUnit\Framework\TestCase;
2121
use Exception, Generator;
22-
use function array_map, sprintf, str_repeat, substr;
22+
use function array_map, defined, sprintf, str_repeat, substr;
2323

2424
/**
2525
* Tests the QR Code reader
@@ -40,6 +40,11 @@ abstract class QRCodeReaderTestAbstract extends TestCase{
4040
protected string $FQN;
4141

4242
protected function setUp():void{
43+
44+
if(!defined('READER_TEST_MAX_VERSION')){
45+
$this::markTestSkipped('READER_TEST_MAX_VERSION not defined (see phpunit.xml.dist)');
46+
}
47+
4348
$this->options = new QROptions;
4449
$this->options->readerUseImagickIfAvailable = false;
4550
}
@@ -117,7 +122,8 @@ public static function dataTestProvider():Generator{
117122
$str = str_repeat(self::loremipsum, 5);
118123
$eccLevels = array_map(fn(int $ecc):EccLevel => new EccLevel($ecc), [EccLevel::L, EccLevel::M, EccLevel::Q, EccLevel::H]);
119124

120-
for($v = 1; $v <= 40; $v++){
125+
/** @noinspection PhpUndefinedConstantInspection - see phpunit.xml.dist */
126+
for($v = 1; $v <= READER_TEST_MAX_VERSION; $v++){
121127
$version = new Version($v);
122128

123129
foreach($eccLevels as $eccLevel){

0 commit comments

Comments
 (0)