mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-10-14 15:57:13 +00:00
🔥 v6.0 third pass: test clean-up (again)
This commit is contained in:
@@ -10,19 +10,19 @@
|
||||
|
||||
namespace chillerlan\QRCodeTest\Data;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use chillerlan\QRCode\{QRCode, QROptions};
|
||||
use chillerlan\QRCode\Common\{EccLevel, MaskPattern, Version};
|
||||
use chillerlan\QRCode\Data\{QRCodeDataException, QRMatrix};
|
||||
use chillerlan\QRCode\Output\QRStringText;
|
||||
use chillerlan\QRCodeTest\QRMatrixDebugTrait;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Generator;
|
||||
use function defined;
|
||||
|
||||
/**
|
||||
* Tests the QRMatrix class
|
||||
*/
|
||||
final class QRMatrixTest extends TestCase{
|
||||
use QRMatrixDebugTrait;
|
||||
|
||||
private const version = 40;
|
||||
private QRMatrix $matrix;
|
||||
@@ -37,70 +37,6 @@ final class QRMatrixTest extends TestCase{
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Matrix debugging console output
|
||||
*/
|
||||
public static function debugMatrix(QRMatrix $matrix):void{
|
||||
|
||||
/** @noinspection PhpUndefinedConstantInspection - see phpunit.xml.dist */
|
||||
if(defined('TEST_IS_CI') && TEST_IS_CI === true){
|
||||
return;
|
||||
}
|
||||
|
||||
$opt = new QROptions;
|
||||
$opt->eol = "\n";
|
||||
$opt->moduleValues = [
|
||||
// finder
|
||||
QRMatrix::M_FINDER_DARK => QRStringText::ansi8('██', 124), // dark (true)
|
||||
QRMatrix::M_FINDER => QRStringText::ansi8('░░', 124), // light (false)
|
||||
QRMatrix::M_FINDER_DOT => QRStringText::ansi8('██', 124), // finder dot, dark (true)
|
||||
// alignment
|
||||
QRMatrix::M_ALIGNMENT_DARK => QRStringText::ansi8('██', 2),
|
||||
QRMatrix::M_ALIGNMENT => QRStringText::ansi8('░░', 2),
|
||||
// timing
|
||||
QRMatrix::M_TIMING_DARK => QRStringText::ansi8('██', 184),
|
||||
QRMatrix::M_TIMING => QRStringText::ansi8('░░', 184),
|
||||
// format
|
||||
QRMatrix::M_FORMAT_DARK => QRStringText::ansi8('██', 200),
|
||||
QRMatrix::M_FORMAT => QRStringText::ansi8('░░', 200),
|
||||
// version
|
||||
QRMatrix::M_VERSION_DARK => QRStringText::ansi8('██', 21),
|
||||
QRMatrix::M_VERSION => QRStringText::ansi8('░░', 21),
|
||||
// data
|
||||
QRMatrix::M_DATA_DARK => QRStringText::ansi8('██', 166),
|
||||
QRMatrix::M_DATA => QRStringText::ansi8('░░', 166),
|
||||
// dark module
|
||||
QRMatrix::M_DARKMODULE => QRStringText::ansi8('██', 53),
|
||||
// separator
|
||||
QRMatrix::M_SEPARATOR => QRStringText::ansi8('░░', 219),
|
||||
// quiet zone
|
||||
QRMatrix::M_QUIETZONE => QRStringText::ansi8('░░', 195),
|
||||
// logo space
|
||||
QRMatrix::M_LOGO => QRStringText::ansi8('░░', 105),
|
||||
// empty
|
||||
QRMatrix::M_NULL => QRStringText::ansi8('░░', 231),
|
||||
];
|
||||
|
||||
$out = (new QRStringText($opt, $matrix))->dump();
|
||||
|
||||
echo "\n\n".$out."\n\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* debugging shortcut - limit to a single version when using with matrixProvider
|
||||
*
|
||||
* @see QRMatrixTest::matrixProvider()
|
||||
*/
|
||||
protected function dm(QRMatrix $matrix):void{
|
||||
|
||||
// limit
|
||||
if($matrix->getVersion()->getVersionNumber() !== 7){
|
||||
return;
|
||||
}
|
||||
|
||||
$this::debugMatrix($matrix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the QRMatrix instance
|
||||
*/
|
||||
@@ -599,7 +535,6 @@ final class QRMatrixTest extends TestCase{
|
||||
*/
|
||||
$this::assertSame(0b01111101, $this->matrix->checkNeighbours(5, 5));
|
||||
|
||||
|
||||
/*
|
||||
* M_TYPE check
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user