mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-21 05:42:23 +00:00
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Class QRFpdfTest
|
|
*
|
|
* @created 03.06.2020
|
|
* @author smiley <smiley@chillerlan.net>
|
|
* @copyright 2020 smiley
|
|
* @license MIT
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
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 PHPUnit\Framework\Attributes\Test;
|
|
use FPDF;
|
|
|
|
/**
|
|
* Tests the QRFpdf output class
|
|
*/
|
|
final class QRFpdfTest extends QROutputTestAbstract{
|
|
use RGBArrayModuleValueProviderTrait;
|
|
|
|
protected function getOutputInterface(
|
|
SettingsContainerInterface|QROptions $options,
|
|
QRMatrix $matrix,
|
|
):QROutputInterface{
|
|
return new QRFpdf($options, $matrix);
|
|
}
|
|
|
|
#[Test]
|
|
public function setModuleValues():void{
|
|
|
|
$this->options->moduleValues = [
|
|
// data
|
|
QRMatrix::M_DATA_DARK => [0, 0, 0],
|
|
QRMatrix::M_DATA => [255, 255, 255],
|
|
];
|
|
|
|
$this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
|
|
$this->outputInterface->dump();
|
|
|
|
/** @phpstan-ignore-next-line */
|
|
$this::assertTrue(true); // tricking the code coverage
|
|
}
|
|
|
|
public function testOutputGetResource():void{
|
|
$this->options->returnResource = true;
|
|
$this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
|
|
|
|
$this::assertInstanceOf(FPDF::class, $this->outputInterface->dump());
|
|
}
|
|
|
|
}
|