mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 20:17:17 +00:00
fixed invalid output type exception
This commit is contained in:
@@ -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!');
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user