PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / bacon / bacon-qr-code / test / Common / VersionTest.php
ameliabooking / vendor / bacon / bacon-qr-code / test / Common Last commit date
BitArrayTest.php 8 months ago BitMatrixTest.php 8 months ago BitUtilsTest.php 8 months ago ErrorCorrectionLevelTest.php 8 months ago FormatInformationTest.php 8 months ago ModeTest.php 8 months ago ReedSolomonCodecTest.php 8 months ago VersionTest.php 8 months ago
VersionTest.php
79 lines
1 <?php
2 declare(strict_types = 1);
3
4 namespace BaconQrCodeTest\Common;
5
6 use BaconQrCode\Common\ErrorCorrectionLevel;
7 use BaconQrCode\Common\Version;
8 use PHPUnit\Framework\TestCase;
9
10 class VersionTest extends TestCase
11 {
12 public function versions() : array
13 {
14 $array = [];
15
16 for ($i = 1; $i <= 40; ++$i) {
17 $array[] = [$i, 4 * $i + 17];
18 }
19
20 return $array;
21 }
22
23 public function decodeInformation() : array
24 {
25 return [
26 [7, 0x07c94],
27 [12, 0x0c762],
28 [17, 0x1145d],
29 [22, 0x168c9],
30 [27, 0x1b08e],
31 [32, 0x209d5],
32 ];
33 }
34
35 /**
36 * @dataProvider versions
37 */
38 public function testVersionForNumber(int $versionNumber, int $dimension) : void
39 {
40 $version = Version::getVersionForNumber($versionNumber);
41
42 $this->assertNotNull($version);
43 $this->assertEquals($versionNumber, $version->getVersionNumber());
44 $this->assertNotNull($version->getAlignmentPatternCenters());
45
46 if ($versionNumber > 1) {
47 $this->assertTrue(count($version->getAlignmentPatternCenters()) > 0);
48 }
49
50 $this->assertEquals($dimension, $version->getDimensionForVersion());
51 $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::H()));
52 $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::L()));
53 $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::M()));
54 $this->assertNotNull($version->getEcBlocksForLevel(ErrorCorrectionLevel::Q()));
55 $this->assertNotNull($version->buildFunctionPattern());
56 }
57
58 /**
59 * @dataProvider versions
60 */
61 public function testGetProvisionalVersionForDimension(int $versionNumber, int $dimension) : void
62 {
63 $this->assertSame(
64 $versionNumber,
65 Version::getProvisionalVersionForDimension($dimension)->getVersionNumber()
66 );
67 }
68
69 /**
70 * @dataProvider decodeInformation
71 */
72 public function testDecodeVersionInformation(int $expectedVersion, int $mask) : void
73 {
74 $version = Version::decodeVersionInformation($mask);
75 $this->assertNotNull($version);
76 $this->assertSame($expectedVersion, $version->getVersionNumber());
77 }
78 }
79