Debian Codegraph @

test/Common/ErrorCorrectionLevelTest.php

raw
1 <?php
2 declare(strict_types = 1);
3
4 namespace BaconQrCodeTest\Common;
5
6 use BaconQrCode\Common\ErrorCorrectionLevel;
7 use BaconQrCode\Exception\OutOfBoundsException;
8 use PHPUnit\Framework\TestCase;
9
10 class ErrorCorrectionLevelTest extends TestCase
11 {
12 public function testBitsMatchConstants() : void
13 {
14 $this->assertSame(0x0, ErrorCorrectionLevel::M()->getBits());
15 $this->assertSame(0x1, ErrorCorrectionLevel::L()->getBits());
16 $this->assertSame(0x2, ErrorCorrectionLevel::H()->getBits());
17 $this->assertSame(0x3, ErrorCorrectionLevel::Q()->getBits());
18 }
19
20 public function testInvalidErrorCorrectionLevelThrowsException() : void
21 {
22 $this->expectException(OutOfBoundsException::class);
23 ErrorCorrectionLevel::forBits(4);
24 }
25 }