diff --git a/benchmark/BenchmarkAbstract.php b/benchmark/BenchmarkAbstract.php index 451320e93..9c28c6b24 100644 --- a/benchmark/BenchmarkAbstract.php +++ b/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; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 932400dd8..b600c7e92 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,8 @@ tests - tests/Performance + tests/samples + tests/Traits diff --git a/tests/Data/DataInterfaceTestAbstract.php b/tests/Data/DataInterfaceTestAbstract.php index c28c43a68..e1a81180c 100644 --- a/tests/Data/DataInterfaceTestAbstract.php +++ b/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; diff --git a/tests/Data/QRDataTest.php b/tests/Data/QRDataTest.php index 0e7fb7654..c4b1e3d71 100644 --- a/tests/Data/QRDataTest.php +++ b/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{ diff --git a/tests/Data/QRMatrixTest.php b/tests/Data/QRMatrixTest.php index d2ffec8e8..e4b7d855c 100755 --- a/tests/Data/QRMatrixTest.php +++ b/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; diff --git a/tests/Output/QRFpdfTest.php b/tests/Output/QRFpdfTest.php index 390c22792..4b0d71e3d 100644 --- a/tests/Output/QRFpdfTest.php +++ b/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; diff --git a/tests/Output/QRGdImageTestAbstract.php b/tests/Output/QRGdImageTestAbstract.php index b59f09c9b..b7faa1130 100644 --- a/tests/Output/QRGdImageTestAbstract.php +++ b/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; diff --git a/tests/Output/QRInterventionImageTest.php b/tests/Output/QRInterventionImageTest.php index 2c127c760..49ee74759 100644 --- a/tests/Output/QRInterventionImageTest.php +++ b/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; diff --git a/tests/Output/QRMarkupTestAbstract.php b/tests/Output/QRMarkupTestAbstract.php index 44f2902e2..ed54b4acf 100644 --- a/tests/Output/QRMarkupTestAbstract.php +++ b/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 diff --git a/tests/Output/QROutputTestAbstract.php b/tests/Output/QROutputTestAbstract.php index 5b3231bd1..f05f1ef09 100644 --- a/tests/Output/QROutputTestAbstract.php +++ b/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}; diff --git a/tests/Output/QRStringJSONTest.php b/tests/Output/QRStringJSONTest.php index 59317d082..f86d3104c 100644 --- a/tests/Output/QRStringJSONTest.php +++ b/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{ diff --git a/tests/QRCodeReaderTestAbstract.php b/tests/QRCodeReaderTestAbstract.php index 9dcbae4d5..4c8374ca1 100644 --- a/tests/QRCodeReaderTestAbstract.php +++ b/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; /** diff --git a/tests/QRCodeTest.php b/tests/QRCodeTest.php index ff1c863e1..0b001c922 100755 --- a/tests/QRCodeTest.php +++ b/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; diff --git a/tests/BuildDirTrait.php b/tests/Traits/BuildDirTrait.php similarity index 93% rename from tests/BuildDirTrait.php rename to tests/Traits/BuildDirTrait.php index 93b6fa8e9..ba6b59b67 100644 --- a/tests/BuildDirTrait.php +++ b/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, '\\/'); } /** diff --git a/tests/Output/CssColorModuleValueProviderTrait.php b/tests/Traits/CssColorModuleValueProviderTrait.php similarity index 97% rename from tests/Output/CssColorModuleValueProviderTrait.php rename to tests/Traits/CssColorModuleValueProviderTrait.php index 2b520103d..b51e38731 100644 --- a/tests/Output/CssColorModuleValueProviderTrait.php +++ b/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 diff --git a/tests/QRMatrixDebugTrait.php b/tests/Traits/QRMatrixDebugTrait.php similarity index 98% rename from tests/QRMatrixDebugTrait.php rename to tests/Traits/QRMatrixDebugTrait.php index 041ce73dc..bad235ff8 100644 --- a/tests/QRMatrixDebugTrait.php +++ b/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; diff --git a/tests/QRMaxLengthTrait.php b/tests/Traits/QRMaxLengthTrait.php similarity index 99% rename from tests/QRMaxLengthTrait.php rename to tests/Traits/QRMaxLengthTrait.php index 93a41589a..05a79e11c 100644 --- a/tests/QRMaxLengthTrait.php +++ b/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; diff --git a/tests/Output/RGBArrayModuleValueProviderTrait.php b/tests/Traits/RGBArrayModuleValueProviderTrait.php similarity index 95% rename from tests/Output/RGBArrayModuleValueProviderTrait.php rename to tests/Traits/RGBArrayModuleValueProviderTrait.php index db703a6b5..c0a661271 100644 --- a/tests/Output/RGBArrayModuleValueProviderTrait.php +++ b/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