mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-18 08:20:03 +00:00
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Class QRStringJSONTest
|
|
*
|
|
* @created 11.12.2021
|
|
* @author smiley <smiley@chillerlan.net>
|
|
* @copyright 2021 smiley
|
|
* @license MIT
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
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;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
|
|
/**
|
|
* Tests the QRStringJSON output class
|
|
*/
|
|
final class QRStringJSONTest extends QROutputTestAbstract{
|
|
use CssColorModuleValueProviderTrait;
|
|
|
|
protected function getOutputInterface(
|
|
SettingsContainerInterface|QROptions $options,
|
|
QRMatrix $matrix,
|
|
):QROutputInterface{
|
|
return new QRStringJSON($options, $matrix);
|
|
}
|
|
|
|
#[Test]
|
|
public function setModuleValues():void{
|
|
|
|
$this->options->moduleValues = [
|
|
// data
|
|
QRMatrix::M_DATA_DARK => '#AAA',
|
|
QRMatrix::M_DATA => '#BBB',
|
|
];
|
|
|
|
$this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
|
|
$data = $this->outputInterface->dump();
|
|
|
|
$this::assertStringContainsString('"layer":"data-dark","value":"#AAA"', $data);
|
|
$this::assertStringContainsString('"layer":"data","value":"#BBB"', $data);
|
|
}
|
|
|
|
}
|