added code length overflow exception

This commit is contained in:
smiley
2016-02-09 16:51:51 +01:00
parent b1a67d6cd3
commit 76a035cea6
+16 -2
View File
@@ -71,10 +71,14 @@ class QRCodeTest extends \PHPUnit_Framework_TestCase{
}
}
public function testTypeAutoOverride(){
/**
* @dataProvider stringDataProvider
*/
public function testTypeAutoOverride($data){
$this->options->typeNumber = QRCode::TYPE_05;
new QRCode('foobar', new QRString, $this->options);
new QRCode($data, new QRString, $this->options);
}
/**
* @expectedException \chillerlan\QRCode\QRCodeException
* @expectedExceptionMessage No data given.
@@ -92,4 +96,14 @@ class QRCodeTest extends \PHPUnit_Framework_TestCase{
new QRCode('foobar', new QRString, $this->options);
}
/**
* @expectedException \chillerlan\QRCode\QRCodeException
* @expectedExceptionMessage code length overflow. (261 > 72bit)
*/
public function testCodeLengthOverflowException(){
$this->options->typeNumber = QRCode::TYPE_01;
$this->options->errorCorrectLevel = QRCode::ERROR_CORRECT_LEVEL_H;
(new QRCode('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:', new QRString, $this->options))->getRawData();
}
}