Explorar el Código

:shower: test cleanup

codemasher hace 4 años
padre
commit
5347080444

+ 1 - 1
tests/Common/BitBufferTest.php

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
  */
 final class BitBufferTest extends TestCase{
 
-	protected BitBuffer $bitBuffer;
+	private BitBuffer $bitBuffer;
 
 	protected function setUp():void{
 		$this->bitBuffer = new BitBuffer;

+ 2 - 2
tests/Data/QRMatrixTest.php

@@ -21,8 +21,8 @@ use Generator;
  */
 final class QRMatrixTest extends TestCase{
 
-	protected const version = 40;
-	protected QRMatrix $matrix;
+	private const version = 40;
+	private QRMatrix $matrix;
 
 	/**
 	 * invokes a QRMatrix object

+ 6 - 8
tests/Output/QRFpdfTest.php

@@ -11,21 +11,21 @@
 namespace chillerlan\QRCodeTest\Output;
 
 use FPDF;
-use chillerlan\QRCode\Output\{QRFpdf, QROutputInterface};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCode\Output\{QRFpdf, QROutputInterface};
 
 use function class_exists, substr;
 
 /**
  * Tests the QRFpdf output module
  */
-class QRFpdfTest extends QROutputTestAbstract{
+final class QRFpdfTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
-	public function setUp():void{
+	protected function setUp():void{
 
 		if(!class_exists(FPDF::class)){
 			$this->markTestSkipped('FPDF not available');
@@ -36,7 +36,6 @@ class QRFpdfTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	protected function getOutputInterface(QROptions $options):QROutputInterface{
 		return new QRFpdf($options, $this->matrix);
@@ -44,7 +43,6 @@ class QRFpdfTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	public function types():array{
 		return [
@@ -59,8 +57,8 @@ class QRFpdfTest extends QROutputTestAbstract{
 
 		$this->options->moduleValues = [
 			// data
-			1024 => [0, 0, 0],
-			4    => [255, 255, 255],
+			QRMatrix::M_DATA | QRMatrix::IS_DARK => [0, 0, 0],
+			QRMatrix::M_DATA                     => [255, 255, 255],
 		];
 
 		$this->outputInterface = $this->getOutputInterface($this->options);

+ 7 - 8
tests/Output/QRImageTest.php

@@ -10,19 +10,20 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
+use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Output\{QROutputInterface, QRImage};
+use const PHP_MAJOR_VERSION;
 
 /**
  * Tests the QRImage output module
  */
-class QRImageTest extends QROutputTestAbstract{
+final class QRImageTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
-	public function setUp():void{
+	protected function setUp():void{
 
 		if(!extension_loaded('gd')){
 			$this->markTestSkipped('ext-gd not loaded');
@@ -33,7 +34,6 @@ class QRImageTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	protected function getOutputInterface(QROptions $options):QROutputInterface{
 		return new QRImage($options, $this->matrix);
@@ -41,7 +41,6 @@ class QRImageTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	public function types():array{
 		return [
@@ -58,8 +57,8 @@ class QRImageTest extends QROutputTestAbstract{
 
 		$this->options->moduleValues = [
 			// data
-			1024 => [0, 0, 0],
-			4    => [255, 255, 255],
+			QRMatrix::M_DATA | QRMatrix::IS_DARK => [0, 0, 0],
+			QRMatrix::M_DATA                     => [255, 255, 255],
 		];
 
 		$this->outputInterface = $this->getOutputInterface($this->options);
@@ -78,7 +77,7 @@ class QRImageTest extends QROutputTestAbstract{
 		$actual = $this->outputInterface->dump();
 
 		/** @noinspection PhpFullyQualifiedNameUsageInspection */
-		\PHP_MAJOR_VERSION >= 8
+		PHP_MAJOR_VERSION >= 8
 			? $this::assertInstanceOf(\GdImage::class, $actual)
 			: $this::assertIsResource($actual);
 	}

+ 5 - 7
tests/Output/QRImagickTest.php

@@ -14,19 +14,19 @@
 namespace chillerlan\QRCodeTest\Output;
 
 use Imagick;
+use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Output\{QROutputInterface, QRImagick};
 
 /**
  * Tests the QRImagick output module
  */
-class QRImagickTest extends QROutputTestAbstract{
+final class QRImagickTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
-	public function setUp():void{
+	protected function setUp():void{
 
 		if(!extension_loaded('imagick')){
 			$this->markTestSkipped('ext-imagick not loaded');
@@ -37,7 +37,6 @@ class QRImagickTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	protected function getOutputInterface(QROptions $options):QROutputInterface{
 		return new QRImagick($options, $this->matrix);
@@ -45,7 +44,6 @@ class QRImagickTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	public function types():array{
 		return [
@@ -60,8 +58,8 @@ class QRImagickTest extends QROutputTestAbstract{
 
 		$this->options->moduleValues = [
 			// data
-			1024 => '#4A6000',
-			4    => '#ECF9BE',
+			QRMatrix::M_DATA | QRMatrix::IS_DARK => '#4A6000',
+			QRMatrix::M_DATA                     => '#ECF9BE',
 		];
 
 		$this->outputInterface = $this->getOutputInterface($this->options);

+ 3 - 4
tests/Output/QRMarkupTest.php

@@ -10,17 +10,17 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
-use chillerlan\QRCode\{Data\QRMatrix, QRCode, QROptions};
+use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Output\{QROutputInterface, QRMarkup};
 
 /**
  * Tests the QRMarkup output module
  */
-class QRMarkupTest extends QROutputTestAbstract{
+final class QRMarkupTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	protected function getOutputInterface(QROptions $options):QROutputInterface{
 		return new QRMarkup($options, $this->matrix);
@@ -28,7 +28,6 @@ class QRMarkupTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	public function types():array{
 		return [

+ 4 - 12
tests/Output/QROutputTestAbstract.php

@@ -26,19 +26,14 @@ use const PHP_OS_FAMILY, PHP_VERSION_ID;
  */
 abstract class QROutputTestAbstract extends TestCase{
 
-	/** @internal  */
-	protected string $builddir = __DIR__.'/../../.build/output_test';
-	/** @internal  */
+	/** @var \chillerlan\QRCode\QROptions|\chillerlan\Settings\SettingsContainerInterface */
+	protected QROptions         $options;
 	protected QROutputInterface $outputInterface;
-	/** @internal  */
-	protected QROptions $options;
-	/** @internal  */
-	protected QRMatrix $matrix;
+	protected QRMatrix          $matrix;
+	protected string            $builddir = __DIR__.'/../../.build/output_test';
 
 	/**
 	 * Attempts to create a directory under /.build and instances several required objects
-	 *
-	 * @internal
 	 */
 	protected function setUp():void{
 
@@ -54,8 +49,6 @@ abstract class QROutputTestAbstract extends TestCase{
 
 	/**
 	 * Returns a QROutputInterface instance with the given options and using $this->matrix
-	 *
-	 * @internal
 	 */
 	abstract protected function getOutputInterface(QROptions $options):QROutputInterface;
 
@@ -90,7 +83,6 @@ abstract class QROutputTestAbstract extends TestCase{
 	/**
 	 * @see testStringOutput()
 	 * @return string[][]
-	 * @internal
 	 */
 	abstract public function types():array;
 

+ 1 - 3
tests/Output/QRStringTest.php

@@ -19,11 +19,10 @@ use chillerlan\QRCodeExamples\MyCustomOutput;
 /**
  * Tests the QRString output module
  */
-class QRStringTest extends QROutputTestAbstract{
+final class QRStringTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	protected function getOutputInterface(QROptions $options):QROutputInterface{
 		return new QRString($options, $this->matrix);
@@ -31,7 +30,6 @@ class QRStringTest extends QROutputTestAbstract{
 
 	/**
 	 * @inheritDoc
-	 * @internal
 	 */
 	public function types():array{
 		return [

+ 1 - 1
tests/QRCodeReaderTest.php

@@ -23,7 +23,7 @@ use function extension_loaded, range, sprintf, str_repeat, substr;
 /**
  * Tests the QR Code reader
  */
-class QRCodeReaderTest extends TestCase{
+final class QRCodeReaderTest extends TestCase{
 
 	// https://www.bobrosslipsum.com/
 	protected const loremipsum = 'Just let this happen. We just let this flow right out of our minds. '

+ 3 - 7
tests/QRCodeTest.php

@@ -18,17 +18,13 @@ use PHPUnit\Framework\TestCase;
 /**
  * Tests basic functions of the QRCode class
  */
-class QRCodeTest extends TestCase{
+final class QRCodeTest extends TestCase{
 
-	/** @internal  */
-	protected QRCode $qrcode;
-	/** @internal  */
-	protected QROptions $options;
+	private QRCode $qrcode;
+	private QROptions $options;
 
 	/**
 	 * invoke test instances
-	 *
-	 * @internal
 	 */
 	protected function setUp():void{
 		$this->qrcode  = new QRCode;

+ 1 - 9
tests/QROptionsTest.php

@@ -18,12 +18,10 @@ use PHPUnit\Framework\TestCase;
 /**
  * QROptions test
  */
-class QROptionsTest extends TestCase{
+final class QROptionsTest extends TestCase{
 
 	/**
-	 * @see testVersionClamp()
 	 * @return int[][]
-	 * @internal
 	 */
 	public function VersionProvider():array{
 		return [
@@ -46,9 +44,7 @@ class QROptionsTest extends TestCase{
 	}
 
 	/**
-	 * @see testVersionMinMaxClamp()
 	 * @return int[][]
-	 * @internal
 	 */
 	public function VersionMinMaxProvider():array{
 		return [
@@ -72,9 +68,7 @@ class QROptionsTest extends TestCase{
 	}
 
 	/**
-	 * @see testMaskPatternClamp()
 	 * @return int[][]
-	 * @internal
 	 */
 	public function MaskPatternProvider():array{
 		return [
@@ -106,9 +100,7 @@ class QROptionsTest extends TestCase{
 	}
 
 	/**
-	 * @see testClampRGBValues()
 	 * @return int[][][]
-	 * @internal
 	 */
 	public function RGBProvider():array{
 		return [