Skip to content

Commit 5347080

Browse files
committed
🚿 test cleanup
1 parent 87f7f3a commit 5347080

11 files changed

+34
-62
lines changed

tests/Common/BitBufferTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
final class BitBufferTest extends TestCase{
2020

21-
protected BitBuffer $bitBuffer;
21+
private BitBuffer $bitBuffer;
2222

2323
protected function setUp():void{
2424
$this->bitBuffer = new BitBuffer;

tests/Data/QRMatrixTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222
final class QRMatrixTest extends TestCase{
2323

24-
protected const version = 40;
25-
protected QRMatrix $matrix;
24+
private const version = 40;
25+
private QRMatrix $matrix;
2626

2727
/**
2828
* invokes a QRMatrix object

tests/Output/QRFpdfTest.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
namespace chillerlan\QRCodeTest\Output;
1212

1313
use FPDF;
14-
use chillerlan\QRCode\Output\{QRFpdf, QROutputInterface};
1514
use chillerlan\QRCode\{QRCode, QROptions};
15+
use chillerlan\QRCode\Data\QRMatrix;
16+
use chillerlan\QRCode\Output\{QRFpdf, QROutputInterface};
1617

1718
use function class_exists, substr;
1819

1920
/**
2021
* Tests the QRFpdf output module
2122
*/
22-
class QRFpdfTest extends QROutputTestAbstract{
23+
final class QRFpdfTest extends QROutputTestAbstract{
2324

2425
/**
2526
* @inheritDoc
26-
* @internal
2727
*/
28-
public function setUp():void{
28+
protected function setUp():void{
2929

3030
if(!class_exists(FPDF::class)){
3131
$this->markTestSkipped('FPDF not available');
@@ -36,15 +36,13 @@ public function setUp():void{
3636

3737
/**
3838
* @inheritDoc
39-
* @internal
4039
*/
4140
protected function getOutputInterface(QROptions $options):QROutputInterface{
4241
return new QRFpdf($options, $this->matrix);
4342
}
4443

4544
/**
4645
* @inheritDoc
47-
* @internal
4846
*/
4947
public function types():array{
5048
return [
@@ -59,8 +57,8 @@ public function testSetModuleValues():void{
5957

6058
$this->options->moduleValues = [
6159
// data
62-
1024 => [0, 0, 0],
63-
4 => [255, 255, 255],
60+
QRMatrix::M_DATA | QRMatrix::IS_DARK => [0, 0, 0],
61+
QRMatrix::M_DATA => [255, 255, 255],
6462
];
6563

6664
$this->outputInterface = $this->getOutputInterface($this->options);

tests/Output/QRImageTest.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@
1010

1111
namespace chillerlan\QRCodeTest\Output;
1212

13+
use chillerlan\QRCode\Data\QRMatrix;
1314
use chillerlan\QRCode\{QRCode, QROptions};
1415
use chillerlan\QRCode\Output\{QROutputInterface, QRImage};
16+
use const PHP_MAJOR_VERSION;
1517

1618
/**
1719
* Tests the QRImage output module
1820
*/
19-
class QRImageTest extends QROutputTestAbstract{
21+
final class QRImageTest extends QROutputTestAbstract{
2022

2123
/**
2224
* @inheritDoc
23-
* @internal
2425
*/
25-
public function setUp():void{
26+
protected function setUp():void{
2627

2728
if(!extension_loaded('gd')){
2829
$this->markTestSkipped('ext-gd not loaded');
@@ -33,15 +34,13 @@ public function setUp():void{
3334

3435
/**
3536
* @inheritDoc
36-
* @internal
3737
*/
3838
protected function getOutputInterface(QROptions $options):QROutputInterface{
3939
return new QRImage($options, $this->matrix);
4040
}
4141

4242
/**
4343
* @inheritDoc
44-
* @internal
4544
*/
4645
public function types():array{
4746
return [
@@ -58,8 +57,8 @@ public function testSetModuleValues():void{
5857

5958
$this->options->moduleValues = [
6059
// data
61-
1024 => [0, 0, 0],
62-
4 => [255, 255, 255],
60+
QRMatrix::M_DATA | QRMatrix::IS_DARK => [0, 0, 0],
61+
QRMatrix::M_DATA => [255, 255, 255],
6362
];
6463

6564
$this->outputInterface = $this->getOutputInterface($this->options);
@@ -78,7 +77,7 @@ public function testOutputGetResource():void{
7877
$actual = $this->outputInterface->dump();
7978

8079
/** @noinspection PhpFullyQualifiedNameUsageInspection */
81-
\PHP_MAJOR_VERSION >= 8
80+
PHP_MAJOR_VERSION >= 8
8281
? $this::assertInstanceOf(\GdImage::class, $actual)
8382
: $this::assertIsResource($actual);
8483
}

tests/Output/QRImagickTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
namespace chillerlan\QRCodeTest\Output;
1515

1616
use Imagick;
17+
use chillerlan\QRCode\Data\QRMatrix;
1718
use chillerlan\QRCode\{QRCode, QROptions};
1819
use chillerlan\QRCode\Output\{QROutputInterface, QRImagick};
1920

2021
/**
2122
* Tests the QRImagick output module
2223
*/
23-
class QRImagickTest extends QROutputTestAbstract{
24+
final class QRImagickTest extends QROutputTestAbstract{
2425

2526
/**
2627
* @inheritDoc
27-
* @internal
2828
*/
29-
public function setUp():void{
29+
protected function setUp():void{
3030

3131
if(!extension_loaded('imagick')){
3232
$this->markTestSkipped('ext-imagick not loaded');
@@ -37,15 +37,13 @@ public function setUp():void{
3737

3838
/**
3939
* @inheritDoc
40-
* @internal
4140
*/
4241
protected function getOutputInterface(QROptions $options):QROutputInterface{
4342
return new QRImagick($options, $this->matrix);
4443
}
4544

4645
/**
4746
* @inheritDoc
48-
* @internal
4947
*/
5048
public function types():array{
5149
return [
@@ -60,8 +58,8 @@ public function testSetModuleValues():void{
6058

6159
$this->options->moduleValues = [
6260
// data
63-
1024 => '#4A6000',
64-
4 => '#ECF9BE',
61+
QRMatrix::M_DATA | QRMatrix::IS_DARK => '#4A6000',
62+
QRMatrix::M_DATA => '#ECF9BE',
6563
];
6664

6765
$this->outputInterface = $this->getOutputInterface($this->options);

tests/Output/QRMarkupTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,24 @@
1010

1111
namespace chillerlan\QRCodeTest\Output;
1212

13-
use chillerlan\QRCode\{Data\QRMatrix, QRCode, QROptions};
13+
use chillerlan\QRCode\{QRCode, QROptions};
14+
use chillerlan\QRCode\Data\QRMatrix;
1415
use chillerlan\QRCode\Output\{QROutputInterface, QRMarkup};
1516

1617
/**
1718
* Tests the QRMarkup output module
1819
*/
19-
class QRMarkupTest extends QROutputTestAbstract{
20+
final class QRMarkupTest extends QROutputTestAbstract{
2021

2122
/**
2223
* @inheritDoc
23-
* @internal
2424
*/
2525
protected function getOutputInterface(QROptions $options):QROutputInterface{
2626
return new QRMarkup($options, $this->matrix);
2727
}
2828

2929
/**
3030
* @inheritDoc
31-
* @internal
3231
*/
3332
public function types():array{
3433
return [

tests/Output/QROutputTestAbstract.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,14 @@
2626
*/
2727
abstract class QROutputTestAbstract extends TestCase{
2828

29-
/** @internal */
30-
protected string $builddir = __DIR__.'/../../.build/output_test';
31-
/** @internal */
29+
/** @var \chillerlan\QRCode\QROptions|\chillerlan\Settings\SettingsContainerInterface */
30+
protected QROptions $options;
3231
protected QROutputInterface $outputInterface;
33-
/** @internal */
34-
protected QROptions $options;
35-
/** @internal */
36-
protected QRMatrix $matrix;
32+
protected QRMatrix $matrix;
33+
protected string $builddir = __DIR__.'/../../.build/output_test';
3734

3835
/**
3936
* Attempts to create a directory under /.build and instances several required objects
40-
*
41-
* @internal
4237
*/
4338
protected function setUp():void{
4439

@@ -54,8 +49,6 @@ protected function setUp():void{
5449

5550
/**
5651
* Returns a QROutputInterface instance with the given options and using $this->matrix
57-
*
58-
* @internal
5952
*/
6053
abstract protected function getOutputInterface(QROptions $options):QROutputInterface;
6154

@@ -90,7 +83,6 @@ abstract public function testSetModuleValues():void;
9083
/**
9184
* @see testStringOutput()
9285
* @return string[][]
93-
* @internal
9486
*/
9587
abstract public function types():array;
9688

tests/Output/QRStringTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,17 @@
1919
/**
2020
* Tests the QRString output module
2121
*/
22-
class QRStringTest extends QROutputTestAbstract{
22+
final class QRStringTest extends QROutputTestAbstract{
2323

2424
/**
2525
* @inheritDoc
26-
* @internal
2726
*/
2827
protected function getOutputInterface(QROptions $options):QROutputInterface{
2928
return new QRString($options, $this->matrix);
3029
}
3130

3231
/**
3332
* @inheritDoc
34-
* @internal
3533
*/
3634
public function types():array{
3735
return [

tests/QRCodeReaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* Tests the QR Code reader
2525
*/
26-
class QRCodeReaderTest extends TestCase{
26+
final class QRCodeReaderTest extends TestCase{
2727

2828
// https://www.bobrosslipsum.com/
2929
protected const loremipsum = 'Just let this happen. We just let this flow right out of our minds. '

tests/QRCodeTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@
1818
/**
1919
* Tests basic functions of the QRCode class
2020
*/
21-
class QRCodeTest extends TestCase{
21+
final class QRCodeTest extends TestCase{
2222

23-
/** @internal */
24-
protected QRCode $qrcode;
25-
/** @internal */
26-
protected QROptions $options;
23+
private QRCode $qrcode;
24+
private QROptions $options;
2725

2826
/**
2927
* invoke test instances
30-
*
31-
* @internal
3228
*/
3329
protected function setUp():void{
3430
$this->qrcode = new QRCode;

0 commit comments

Comments
 (0)