Pārlūkot izejas kodu

:shower: move and exclude test traits

smiley 1 mēnesi atpakaļ
vecāks
revīzija
8237857cc3

+ 1 - 1
benchmark/BenchmarkAbstract.php

@@ -14,7 +14,7 @@ namespace chillerlan\QRCodeBenchmark;
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Common\{EccLevel, Mode, Version};
 use chillerlan\QRCode\Data\QRMatrix;
-use chillerlan\QRCodeTest\QRMaxLengthTrait;
+use chillerlan\QRCodeTest\Traits\QRMaxLengthTrait;
 use PhpBench\Attributes\{Iterations, ParamProviders, Revs, Warmup};
 use Generator, RuntimeException;
 use function extension_loaded, is_dir, mb_substr, mkdir, sprintf, str_repeat, str_replace;

+ 2 - 1
phpunit.xml.dist

@@ -8,7 +8,8 @@
 	<testsuites>
 		<testsuite name="php-qrcode test suite">
 			<directory>tests</directory>
-			<exclude>tests/Performance</exclude>
+			<exclude>tests/samples</exclude>
+			<exclude>tests/Traits</exclude>
 		</testsuite>
 	</testsuites>
 	<source>

+ 1 - 1
tests/Data/DataInterfaceTestAbstract.php

@@ -14,7 +14,7 @@ namespace chillerlan\QRCodeTest\Data;
 use chillerlan\QRCode\Common\{BitBuffer, EccLevel, MaskPattern, Mode, Version};
 use chillerlan\QRCode\Data\{QRCodeDataException, QRData, QRDataModeInterface, QRMatrix};
 use chillerlan\QRCode\QROptions;
-use chillerlan\QRCodeTest\QRMaxLengthTrait;
+use chillerlan\QRCodeTest\Traits\QRMaxLengthTrait;
 use Exception, Generator;
 use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\ExpectationFailedException;

+ 1 - 1
tests/Data/QRDataTest.php

@@ -19,7 +19,7 @@ use chillerlan\QRCode\Data\QRData;
 use chillerlan\QRCode\Output\QRGdImagePNG;
 use chillerlan\QRCode\QRCode;
 use chillerlan\QRCode\QROptions;
-use chillerlan\QRCodeTest\QRMatrixDebugTrait;
+use chillerlan\QRCodeTest\Traits\QRMatrixDebugTrait;
 use PHPUnit\Framework\TestCase;
 
 final class QRDataTest extends TestCase{

+ 1 - 1
tests/Data/QRMatrixTest.php

@@ -14,7 +14,7 @@ namespace chillerlan\QRCodeTest\Data;
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Common\{EccLevel, MaskPattern, Version};
 use chillerlan\QRCode\Data\{QRCodeDataException, QRMatrix};
-use chillerlan\QRCodeTest\QRMatrixDebugTrait;
+use chillerlan\QRCodeTest\Traits\QRMatrixDebugTrait;
 use PHPUnit\Framework\TestCase;
 use PHPUnit\Framework\Attributes\DataProvider;
 use Generator;

+ 1 - 0
tests/Output/QRFpdfTest.php

@@ -14,6 +14,7 @@ namespace chillerlan\QRCodeTest\Output;
 use chillerlan\QRCode\QROptions;
 use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Output\{QRFpdf, QROutputInterface};
+use chillerlan\QRCodeTest\Traits\RGBArrayModuleValueProviderTrait;
 use chillerlan\Settings\SettingsContainerInterface;
 use FPDF;
 use function class_exists;

+ 1 - 0
tests/Output/QRGdImageTestAbstract.php

@@ -14,6 +14,7 @@ declare(strict_types=1);
 namespace chillerlan\QRCodeTest\Output;
 
 use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCodeTest\Traits\RGBArrayModuleValueProviderTrait;
 use GdImage;
 use function extension_loaded;
 

+ 1 - 0
tests/Output/QRInterventionImageTest.php

@@ -15,6 +15,7 @@ use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Output\QRInterventionImage;
 use chillerlan\QRCode\Output\QROutputInterface;
 use chillerlan\QRCode\QROptions;
+use chillerlan\QRCodeTest\Traits\CssColorModuleValueProviderTrait;
 use chillerlan\Settings\SettingsContainerInterface;
 use Intervention\Image\Interfaces\ImageInterface;
 use function extension_loaded;

+ 1 - 0
tests/Output/QRMarkupTestAbstract.php

@@ -12,6 +12,7 @@ declare(strict_types=1);
 namespace chillerlan\QRCodeTest\Output;
 
 use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCodeTest\Traits\CssColorModuleValueProviderTrait;
 
 /**
  * Tests the QRMarkup output module

+ 1 - 1
tests/Output/QROutputTestAbstract.php

@@ -11,7 +11,7 @@ declare(strict_types=1);
 
 namespace chillerlan\QRCodeTest\Output;
 
-use chillerlan\QRCodeTest\BuildDirTrait;
+use chillerlan\QRCodeTest\Traits\BuildDirTrait;
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Output\{QRCodeOutputException, QROutputInterface};

+ 1 - 0
tests/Output/QRStringJSONTest.php

@@ -14,6 +14,7 @@ namespace chillerlan\QRCodeTest\Output;
 use chillerlan\QRCode\QROptions;
 use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Output\{QROutputInterface, QRStringJSON};
+use chillerlan\QRCodeTest\Traits\CssColorModuleValueProviderTrait;
 use chillerlan\Settings\SettingsContainerInterface;
 
 final class QRStringJSONTest extends QROutputTestAbstract{

+ 2 - 2
tests/QRCodeReaderTestAbstract.php

@@ -18,11 +18,11 @@ use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Common\{EccLevel, LuminanceSourceInterface, Mode, Version};
 use chillerlan\QRCode\Decoder\Decoder;
 use chillerlan\QRCode\Output\QRGdImagePNG;
+use chillerlan\QRCodeTest\Traits\{QRMatrixDebugTrait, QRMaxLengthTrait};
 use chillerlan\Settings\SettingsContainerInterface;
 use PHPUnit\Framework\Attributes\{DataProvider, Group};
 use PHPUnit\Framework\TestCase;
-use Exception, Generator;
-use RuntimeException;
+use Exception, Generator, RuntimeException;
 use function array_map, defined, realpath, sprintf, str_repeat, substr;
 
 /**

+ 1 - 0
tests/QRCodeTest.php

@@ -13,6 +13,7 @@ namespace chillerlan\QRCodeTest;
 
 use chillerlan\QRCode\{QROptions, QRCode};
 use chillerlan\QRCode\Output\QRCodeOutputException;
+use chillerlan\QRCodeTest\Traits\BuildDirTrait;
 use PHPUnit\Framework\TestCase;
 use stdClass;
 

+ 3 - 3
tests/BuildDirTrait.php → tests/Traits/BuildDirTrait.php

@@ -9,7 +9,7 @@
  */
 declare(strict_types=1);
 
-namespace chillerlan\QRCodeTest;
+namespace chillerlan\QRCodeTest\Traits;
 
 use RuntimeException;
 use function dirname, file_exists, file_get_contents, is_file, mkdir, realpath, sprintf, trim;
@@ -19,13 +19,13 @@ use function dirname, file_exists, file_get_contents, is_file, mkdir, realpath,
  */
 trait BuildDirTrait{
 
-	private string $_buildDir = __DIR__.'/../.build/';
+	protected const _buildDir = __DIR__.'/../../.build/';
 
 	/**
 	 * returns the full raw path to the build dir
 	 */
 	protected function getBuildPath(string $subPath):string{
-		return $this->_buildDir.trim($subPath, '\\/');
+		return $this::_buildDir.trim($subPath, '\\/');
 	}
 
 	/**

+ 1 - 1
tests/Output/CssColorModuleValueProviderTrait.php → tests/Traits/CssColorModuleValueProviderTrait.php

@@ -9,7 +9,7 @@
  */
 declare(strict_types=1);
 
-namespace chillerlan\QRCodeTest\Output;
+namespace chillerlan\QRCodeTest\Traits;
 
 /**
  * A data provider for use in tests that include CssColorModuleValueTrait

+ 1 - 1
tests/QRMatrixDebugTrait.php → tests/Traits/QRMatrixDebugTrait.php

@@ -9,7 +9,7 @@
  */
 declare(strict_types=1);
 
-namespace chillerlan\QRCodeTest;
+namespace chillerlan\QRCodeTest\Traits;
 
 use chillerlan\QRCode\QROptions;
 use chillerlan\QRCode\Data\QRMatrix;

+ 1 - 1
tests/QRMaxLengthTrait.php → tests/Traits/QRMaxLengthTrait.php

@@ -9,7 +9,7 @@
  */
 declare(strict_types=1);
 
-namespace chillerlan\QRCodeTest;
+namespace chillerlan\QRCodeTest\Traits;
 
 use chillerlan\QRCode\Common\{EccLevel, Mode, Version};
 use chillerlan\QRCode\QRCodeException;

+ 1 - 1
tests/Output/RGBArrayModuleValueProviderTrait.php → tests/Traits/RGBArrayModuleValueProviderTrait.php

@@ -9,7 +9,7 @@
  */
 declare(strict_types=1);
 
-namespace chillerlan\QRCodeTest\Output;
+namespace chillerlan\QRCodeTest\Traits;
 
 /**
  * A data provider for use in tests that include RGBArrayModuleValueTrait