-
-
Notifications
You must be signed in to change notification settings - Fork 331
Expand file tree
/
Copy pathQRNetpbmBitmapAsciiTest.php
More file actions
58 lines (50 loc) · 1.45 KB
/
QRNetpbmBitmapAsciiTest.php
File metadata and controls
58 lines (50 loc) · 1.45 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
<?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, QRNetpbmBitmapAscii};
use chillerlan\Settings\SettingsContainerInterface;
use PHPUnit\Framework\Attributes\Test;
/**
* Tests the QRNetpbmBitmapAscii output class
*/
final class QRNetpbmBitmapAsciiTest extends QROutputTestAbstract {
protected function getOutputInterface(
SettingsContainerInterface|QROptions $options,
QRMatrix $matrix,
):QROutputInterface{
return new QRNetpbmBitmapAscii($options, $matrix);
}
/**
* @phpstan-return array<string, array{0: mixed, 1: bool}>
*/
public static function moduleValueProvider():array{
return [
'invalid: wrong type' => [[], false],
'invalid: wrong type' => ['abc', false],
'valid: true' => [true, true],
'valid: false' => [false, true],
];
}
#[Test]
public function setModuleValues():void{
$this->options->moduleValues = [
// data
QRMatrix::M_DATA_DARK => true,
QRMatrix::M_DATA => false,
];
$this->outputInterface = $this->getOutputInterface($this->options, $this->matrix);
$data = $this->outputInterface->dump();
$this::assertStringContainsString('1', $data);
$this::assertStringContainsString('0', $data);
}
}