2021-02-26 16:16:17 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Class QRMarkupTest
|
|
|
|
*
|
|
|
|
* @filesource QRMarkupTest.php
|
|
|
|
* @created 24.12.2017
|
|
|
|
* @package chillerlan\QRCodeTest\Output
|
|
|
|
* @author Smiley <smiley@chillerlan.net>
|
|
|
|
* @copyright 2017 Smiley
|
|
|
|
* @license MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace chillerlan\QRCodeTest\Output;
|
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
use chillerlan\QRCode\{QRCode, QROptions};
|
|
|
|
use chillerlan\QRCode\Output\{QROutputInterface, QRMarkup};
|
2021-02-26 16:16:17 +00:00
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* Tests the QRMarkup output module
|
|
|
|
*/
|
2021-02-26 16:16:17 +00:00
|
|
|
class QRMarkupTest extends QROutputTestAbstract{
|
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
protected function getOutputInterface(QROptions $options):QROutputInterface{
|
|
|
|
return new QRMarkup($options, $this->matrix);
|
|
|
|
}
|
2021-02-26 16:16:17 +00:00
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
public function types():array{
|
2021-02-26 16:16:17 +00:00
|
|
|
return [
|
|
|
|
'html' => [QRCode::OUTPUT_MARKUP_HTML],
|
|
|
|
'svg' => [QRCode::OUTPUT_MARKUP_SVG],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-07-02 14:01:51 +00:00
|
|
|
* @inheritDoc
|
2021-02-26 16:16:17 +00:00
|
|
|
*/
|
2022-07-02 14:01:51 +00:00
|
|
|
public function testSetModuleValues():void{
|
2021-02-26 16:16:17 +00:00
|
|
|
$this->options->imageBase64 = false;
|
|
|
|
$this->options->moduleValues = [
|
|
|
|
// data
|
|
|
|
1024 => '#4A6000',
|
|
|
|
4 => '#ECF9BE',
|
|
|
|
];
|
|
|
|
|
2022-07-02 14:01:51 +00:00
|
|
|
$this->outputInterface = $this->getOutputInterface($this->options);
|
2021-02-26 16:16:17 +00:00
|
|
|
$data = $this->outputInterface->dump();
|
2022-07-02 14:01:51 +00:00
|
|
|
$this::assertStringContainsString('#4A6000', $data);
|
|
|
|
$this::assertStringContainsString('#ECF9BE', $data);
|
2021-02-26 16:16:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|