Skip to content

Commit cb45226

Browse files
committed
🚨 test in php < 7.1
1 parent 2d1ec8d commit cb45226

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

testsDependency/BaconQRCodeTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace TestsDependency;
44

5+
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
56
use PHPUnit\Framework\TestCase;
67
use RobThree\Auth\Providers\Qr\BaconQrCodeProvider;
78
use RobThree\Auth\TwoFactorAuth;
@@ -13,12 +14,19 @@ class BaconQRCodeTest extends TestCase
1314

1415
public function testDependency()
1516
{
16-
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
17+
// php < 7.1 will install an older Bacon QR Code
18+
if (! class_exists(ImagickImageBackEnd::class)) {
19+
$this->expectException(\RuntimeException::class);
1720

18-
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, 'sha1', $qr);
21+
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
22+
} else {
23+
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
1924

20-
$data = $this->DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE'));
21-
$this->assertEquals('image/svg+xml', $data['mimetype']);
25+
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, 'sha1', $qr);
26+
27+
$data = $this->DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE'));
28+
$this->assertEquals('image/svg+xml', $data['mimetype']);
29+
}
2230
}
2331

2432
public function testBadTextColour()

0 commit comments

Comments
 (0)