-
-
Notifications
You must be signed in to change notification settings - Fork 330
Expand file tree
/
Copy pathQRPbmTest.php
More file actions
60 lines (51 loc) · 1.46 KB
/
QRPbmTest.php
File metadata and controls
60 lines (51 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* Class QRPbmTest
*
* @created 11.12.2025
* @author wgevaert
* @copyright 2025 wgevaert
* @license MIT
*/
declare(strict_types=1);
namespace chillerlan\QRCodeTest\Output;
use chillerlan\QRCode\QROptions;
use chillerlan\QRCode\Data\QRMatrix;
use chillerlan\QRCode\Output\{QROutputInterface, QRPbm};
use chillerlan\Settings\SettingsContainerInterface;
use PHPUnit\Framework\Attributes\Test;
/**
* Tests the QRPbm output class
*/
final class QRPbmTest extends QROutputTestAbstract{
protected function getOutputInterface(
SettingsContainerInterface|QROptions $options,
QRMatrix $matrix,
):QROutputInterface{
return new QRPbm($options, $matrix);
}
/**
* @phpstan-return array<string, array{0: mixed, 1: bool}>
*/
public static function moduleValueProvider():array{
return [
'invalid: wrong type' => [[], false],
'invalid: Not 0 or 1' => ['abc', false],
'invalid: empty string' => ['', false],
'invalid: space string' => [' ', false],
'valid: zero' => ['0', true],
];
}
#[Test]
public function setModuleValues():void{
$this->options->moduleValues = [
// data
QRMatrix::M_DATA_DARK => '1',
QRMatrix::M_DATA => '0',
];
$this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
$data = $this->outputInterface->dump();
$this->assertStringContainsString('1', $data);
$this->assertStringContainsString('0', $data);
}
}