2
2
3
3
namespace TestsDependency ;
4
4
5
+ use BaconQrCode \Renderer \Image \ImagickImageBackEnd ;
5
6
use PHPUnit \Framework \TestCase ;
6
7
use RobThree \Auth \Providers \Qr \BaconQrCodeProvider ;
7
8
use RobThree \Auth \TwoFactorAuth ;
@@ -13,12 +14,19 @@ class BaconQRCodeTest extends TestCase
13
14
14
15
public function testDependency ()
15
16
{
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);
17
20
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 ' );
19
24
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
+ }
22
30
}
23
31
24
32
public function testBadTextColour ()
0 commit comments