2021-02-26 16:16:17 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Class MaskPatternTesterTest
|
|
|
|
*
|
|
|
|
* @filesource MaskPatternTesterTest.php
|
|
|
|
* @created 24.11.2017
|
|
|
|
* @package chillerlan\QRCodeTest\Data
|
|
|
|
* @author Smiley <smiley@chillerlan.net>
|
|
|
|
* @copyright 2017 Smiley
|
|
|
|
* @license MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace chillerlan\QRCodeTest\Data;
|
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
use chillerlan\QRCode\QROptions;
|
|
|
|
use chillerlan\QRCode\Data\{Byte, MaskPatternTester};
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2021-02-26 16:16:17 +00:00
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* MaskPatternTester coverage test
|
|
|
|
*/
|
|
|
|
final class MaskPatternTesterTest extends TestCase{
|
2021-02-26 16:16:17 +00:00
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* Tests getting the best mask pattern
|
|
|
|
*/
|
|
|
|
public function testMaskpattern():void{
|
|
|
|
$dataInterface = new Byte(new QROptions(['version' => 10]), 'test');
|
|
|
|
|
|
|
|
$this::assertSame(3, (new MaskPatternTester($dataInterface))->getBestMaskPattern());
|
|
|
|
}
|
2021-02-26 16:16:17 +00:00
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* Tests getting the penalty value for a given mask pattern
|
|
|
|
*/
|
|
|
|
public function testMaskpatternID():void{
|
|
|
|
$dataInterface = new Byte(new QROptions(['version' => 10]), 'test');
|
2021-02-26 16:16:17 +00:00
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
$this::assertSame(4243, (new MaskPatternTester($dataInterface))->testPattern(3));
|
2021-02-26 16:16:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|