diff options
author | Andrew Dolgov <[email protected]> | 2021-02-26 19:16:17 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-26 19:16:17 +0300 |
commit | 3fd785654372d493c031d9b541ab33a881023a32 (patch) | |
tree | 0a76cb410217074378de3d7012b95754cd3c7e6f /vendor/chillerlan/php-qrcode/tests/Output/QRMarkupTest.php | |
parent | bc4475b6698f5a74e475674aa7af43253c459892 (diff) |
* switch to composer for qrcode and otp dependencies
* move most OTP-related stuff into userhelper
* remove old phpqrcode and otphp libraries
Diffstat (limited to 'vendor/chillerlan/php-qrcode/tests/Output/QRMarkupTest.php')
-rw-r--r-- | vendor/chillerlan/php-qrcode/tests/Output/QRMarkupTest.php | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/vendor/chillerlan/php-qrcode/tests/Output/QRMarkupTest.php b/vendor/chillerlan/php-qrcode/tests/Output/QRMarkupTest.php new file mode 100644 index 000000000..24fdc3ce6 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/tests/Output/QRMarkupTest.php @@ -0,0 +1,79 @@ +<?php +/** + * Class QRMarkupTest + * + * @filesource QRMarkupTest.php + * @created 24.12.2017 + * @package chillerlan\QRCodeTest\Output + * @author Smiley <[email protected]> + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeTest\Output; + +use chillerlan\QRCode\{QRCode, Output\QRMarkup}; + +class QRMarkupTest extends QROutputTestAbstract{ + + protected $FQCN = QRMarkup::class; + + public function types(){ + return [ + 'html' => [QRCode::OUTPUT_MARKUP_HTML], + 'svg' => [QRCode::OUTPUT_MARKUP_SVG], + ]; + } + + /** + * @dataProvider types + * @param $type + */ + public function testMarkupOutputFile($type){ + $this->options->outputType = $type; + $this->options->cachefile = $this::cachefile.$type; + $this->setOutputInterface(); + $data = $this->outputInterface->dump(); + + $this->assertSame($data, file_get_contents($this->options->cachefile)); + } + + /** + * @dataProvider types + * @param $type + */ + public function testMarkupOutput($type){ + $this->options->imageBase64 = false; + $this->options->outputType = $type; + $this->setOutputInterface(); + + $expected = explode($this->options->eol, file_get_contents($this::cachefile.$type)); + // cut off the doctype & head + array_shift($expected); + + if($type === QRCode::OUTPUT_MARKUP_HTML){ + // cut off the </body> tag + array_pop($expected); + } + + $expected = implode($this->options->eol, $expected); + + $this->assertSame(trim($expected), trim($this->outputInterface->dump())); + } + + public function testSetModuleValues(){ + + $this->options->imageBase64 = false; + $this->options->moduleValues = [ + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + ]; + + $this->setOutputInterface(); + $data = $this->outputInterface->dump(); + $this->assertStringContainsString('#4A6000', $data); + $this->assertStringContainsString('#ECF9BE', $data); + } + +} |