From ae4da10ff1266479311244896d40e68214122d9c Mon Sep 17 00:00:00 2001 From: William Hall Date: Sun, 19 Dec 2021 19:33:11 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20test=20bacon=20qr=20code=20provi?= =?UTF-8?q?der?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-bacon.yml | 30 +++++++++++++++++++++++ testsDependency/BaconQRCodeTest.php | 37 +++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/test-bacon.yml create mode 100644 testsDependency/BaconQRCodeTest.php diff --git a/.github/workflows/test-bacon.yml b/.github/workflows/test-bacon.yml new file mode 100644 index 0000000..98c45dd --- /dev/null +++ b/.github/workflows/test-bacon.yml @@ -0,0 +1,30 @@ +name: Test Bacon QR Code Provider + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] + + steps: + - uses: actions/checkout@v2 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + tools: composer + coverage: xdebug + ini-values: error_reporting=E_ALL + + - uses: ramsey/composer-install@v1 + + - run: composer require bacon/bacon-qr-code + + - run: composer lint + - run: composer test testsDependency/BaconQRCodeTest.php diff --git a/testsDependency/BaconQRCodeTest.php b/testsDependency/BaconQRCodeTest.php new file mode 100644 index 0000000..e30988a --- /dev/null +++ b/testsDependency/BaconQRCodeTest.php @@ -0,0 +1,37 @@ +DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE')); + $this->assertEquals('image/svg+xml', $data['mimetype']); + } + + public function testBadTextColour() + { + $this->expectException(\RuntimeException::class); + + new BaconQrCodeProvider(1, 'not-a-colour', '#FFF'); + } + + public function testBadBackgroundColour() + { + $this->expectException(\RuntimeException::class); + + new BaconQrCodeProvider(1, '#000', 'not-a-colour'); + } +}