From b1a67d6cd311d321da973a4080e3cc9ec858adf9 Mon Sep 17 00:00:00 2001 From: smiley Date: Tue, 9 Feb 2016 16:47:16 +0100 Subject: [PATCH] more tests --- tests/UtilTest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/UtilTest.php b/tests/UtilTest.php index 1a7276a34..9d40684b9 100644 --- a/tests/UtilTest.php +++ b/tests/UtilTest.php @@ -9,6 +9,8 @@ namespace chillerlan\QRCodeTest; +use chillerlan\QRCode\QRCode; +use chillerlan\QRCode\QRConst; use chillerlan\QRCode\Util; class UtilTest extends \PHPUnit_Framework_TestCase{ @@ -31,4 +33,33 @@ class UtilTest extends \PHPUnit_Framework_TestCase{ $this->assertEquals(false, Util::isKanji('荷')); // kanji forced into byte mode due to length } + // coverage + public function testGetBCHTypeNumber(){ + $this->assertEquals(7973, Util::getBCHTypeNumber(1)); + } + + /** + * @expectedException \chillerlan\QRCode\QRCodeException + * @expectedExceptionMessage $typeNumber: 1 / $errorCorrectLevel: 42 + */ + public function testGetRSBlocksException(){ + Util::getRSBlocks(1, 42); + } + + /** + * @expectedException \chillerlan\QRCode\QRCodeException + * @expectedExceptionMessage Invalid error correct level: 42 + */ + public static function testGetMaxLengthECLevelException(){ + Util::getMaxLength(QRCode::TYPE_01, QRConst::MODE_BYTE, 42); + } + + /** + * @expectedException \chillerlan\QRCode\QRCodeException + * @expectedExceptionMessage Invalid mode: 1337 + */ + public static function testGetMaxLengthModeException(){ + Util::getMaxLength(QRCode::TYPE_01, 1337, QRCode::ERROR_CORRECT_LEVEL_H); + } + }