From 3484cfd269d041b73e4d292498fea8f23831ef1c Mon Sep 17 00:00:00 2001 From: smiley Date: Tue, 9 Feb 2016 02:13:10 +0100 Subject: [PATCH] fixed invalid output type exception --- src/Output/QRString.php | 2 +- tests/Output/StringTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Output/QRString.php b/src/Output/QRString.php index 67f20a586..23122a912 100644 --- a/src/Output/QRString.php +++ b/src/Output/QRString.php @@ -34,7 +34,7 @@ class QRString extends QROutputBase implements QROutputInterface{ $this->options = new QRStringOptions; } - if(!in_array($this->options->type ,[QRCode::OUTPUT_STRING_TEXT, QRCode::OUTPUT_STRING_JSON, QRCode::OUTPUT_STRING_HTML])){ + if(!in_array($this->options->type, [QRCode::OUTPUT_STRING_TEXT, QRCode::OUTPUT_STRING_JSON, QRCode::OUTPUT_STRING_HTML], true)){ throw new QRCodeOutputException('Invalid string output type!'); } diff --git a/tests/Output/StringTest.php b/tests/Output/StringTest.php index 61a897d55..78700fc16 100644 --- a/tests/Output/StringTest.php +++ b/tests/Output/StringTest.php @@ -49,6 +49,10 @@ class StringTest extends \PHPUnit_Framework_TestCase{ $this->assertEquals($expected, (new QRCode($data, new QRString($this->options)))->output()); } + /** + * @expectedException \chillerlan\QRCode\Output\QRCodeOutputException + * @expectedExceptionMessage Invalid string output type! + */ public function testOutputTypeException(){ $this->options->type = 'foo'; new QRString($this->options);