fixed invalid output type exception

This commit is contained in:
smiley
2016-02-09 02:13:10 +01:00
parent 123cbd3043
commit 3484cfd269
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -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!');
}
+4
View File
@@ -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);