fix the testsDependency folder

This commit is contained in:
Nicolas CARPi
2022-12-07 23:29:04 +01:00
parent db0515e826
commit f1e73aab3a
2 changed files with 10 additions and 8 deletions
+7 -6
View File
@@ -4,6 +4,7 @@ namespace TestsDependency;
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
use PHPUnit\Framework\TestCase;
use RobThree\Auth\Algorithm;
use RobThree\Auth\Providers\Qr\BaconQrCodeProvider;
use RobThree\Auth\Providers\Qr\HandlesDataUri;
use RobThree\Auth\TwoFactorAuth;
@@ -13,7 +14,7 @@ class BaconQRCodeTest extends TestCase
{
use HandlesDataUri;
public function testDependency()
public function testDependency(): void
{
// php < 7.1 will install an older Bacon QR Code
if (!class_exists(ImagickImageBackEnd::class)) {
@@ -23,35 +24,35 @@ class BaconQRCodeTest extends TestCase
} else {
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, 'sha1', $qr);
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, Algorithm::Sha1, $qr);
$data = $this->DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE'));
$this->assertEquals('image/svg+xml', $data['mimetype']);
}
}
public function testBadTextColour()
public function testBadTextColour(): void
{
$this->expectException(RuntimeException::class);
new BaconQrCodeProvider(1, 'not-a-colour', '#FFF');
}
public function testBadBackgroundColour()
public function testBadBackgroundColour(): void
{
$this->expectException(RuntimeException::class);
new BaconQrCodeProvider(1, '#000', 'not-a-colour');
}
public function testBadTextColourHexRef()
public function testBadTextColourHexRef(): void
{
$this->expectException(RuntimeException::class);
new BaconQrCodeProvider(1, '#AAAA', '#FFF');
}
public function testBadBackgroundColourHexRef()
public function testBadBackgroundColourHexRef(): void
{
$this->expectException(RuntimeException::class);
+3 -2
View File
@@ -3,6 +3,7 @@
namespace TestsDependency;
use PHPUnit\Framework\TestCase;
use RobThree\Auth\Algorithm;
use RobThree\Auth\Providers\Qr\EndroidQrCodeProvider;
use RobThree\Auth\Providers\Qr\HandlesDataUri;
use RobThree\Auth\TwoFactorAuth;
@@ -11,10 +12,10 @@ class EndroidQRCodeTest extends TestCase
{
use HandlesDataUri;
public function testDependency()
public function testDependency(): void
{
$qr = new EndroidQrCodeProvider();
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, 'sha1', $qr);
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, Algorithm::Sha1, $qr);
$data = $this->DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE'));
$this->assertEquals('image/png', $data['mimetype']);
$this->assertEquals('base64', $data['encoding']);