blob: c927cc64e909c3e99df2af8464e677c6ace31f51 (
plain)
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
61
62
63
64
65
66
|
<?php
/**
* Class QRImagickTest
*
* @filesource QRImagickTest.php
* @created 04.07.2018
* @package chillerlan\QRCodeTest\Output
* @author smiley <[email protected]>
* @copyright 2018 smiley
* @license MIT
*
* @noinspection PhpComposerExtensionStubsInspection
*/
namespace chillerlan\QRCodeTest\Output;
use Imagick;
use chillerlan\QRCode\{QRCode, Output\QRImagick};
class QRImagickTest extends QROutputTestAbstract{
protected $FQCN = QRImagick::class;
public function setUp():void{
if(!extension_loaded('imagick')){
$this->markTestSkipped('ext-imagick not loaded');
return;
}
parent::setUp();
}
public function testImageOutput(){
$type = QRCode::OUTPUT_IMAGICK;
$this->options->outputType = $type;
$this->setOutputInterface();
$this->outputInterface->dump($this::cachefile.$type);
$img = $this->outputInterface->dump();
$this->assertSame($img, file_get_contents($this::cachefile.$type));
}
public function testSetModuleValues(){
$this->options->moduleValues = [
// data
1024 => '#4A6000',
4 => '#ECF9BE',
];
$this->setOutputInterface()->dump();
$this->assertTrue(true); // tricking the code coverage
}
public function testOutputGetResource():void{
$this->options->returnResource = true;
$this->setOutputInterface();
$this::assertInstanceOf(Imagick::class, $this->outputInterface->dump());
}
}
|