7
7
use OathServerSuite \SecretSharing \SharedSecretUrlEncoder \TotpBase32SharedSecretUrlEncoder ;
8
8
use OathServerSuite \SecretSharing \SharedSecretUrlEncoder \TotpSharedSecretUrlEncoder ;
9
9
use QrCodeSuite \QrEncode \QrEncoder ;
10
- use QrCodeSuite \QrRender \QrCodeRendererPng ;
11
10
12
11
/**
13
12
* Class SharedSecretQrCodeProviderTest
@@ -37,12 +36,9 @@ public function testHotpBase32ProvideQrCode()
37
36
$ this ->assertFileExists ($ qrCodeOutputPath );
38
37
39
38
// Test QR code output file mesaurement
40
- $ blockSize = ceil (1000 / ($ sharedSecretQrCodeProvider ->getQrCode ()->getWidth () + 2 * QrCodeRendererPng::MARGIN ));
41
- $ symbolWidth = ($ sharedSecretQrCodeProvider ->getQrCode ()->getWidth () + 2 * QrCodeRendererPng::MARGIN ) * $ blockSize ;
42
- $ symbolHeight = ($ sharedSecretQrCodeProvider ->getQrCode ()->getHeight () + 2 * QrCodeRendererPng::MARGIN ) * $ blockSize ;
43
39
$ imageSize = getimagesize ($ qrCodeOutputPath );
44
- $ this ->assertEquals ($ symbolWidth , $ imageSize [0 ]);
45
- $ this ->assertEquals ($ symbolHeight , $ imageSize [1 ]);
40
+ $ this ->assertEquals ($ sharedSecretQrCodeProvider -> getQrRenderer ()-> getWidth () , $ imageSize [0 ]);
41
+ $ this ->assertEquals ($ sharedSecretQrCodeProvider -> getQrRenderer ()-> getHeight () , $ imageSize [1 ]);
46
42
47
43
// Remove test QR code output file
48
44
unlink ($ qrCodeOutputPath );
@@ -65,12 +61,9 @@ public function testTotpBase32ProvideQrCode()
65
61
$ this ->assertFileExists ($ qrCodeOutputPath );
66
62
67
63
// Test QR code output file mesaurement
68
- $ blockSize = ceil (1000 / ($ sharedSecretQrCodeProvider ->getQrCode ()->getWidth () + 2 * QrCodeRendererPng::MARGIN ));
69
- $ symbolWidth = ($ sharedSecretQrCodeProvider ->getQrCode ()->getWidth () + 2 * QrCodeRendererPng::MARGIN ) * $ blockSize ;
70
- $ symbolHeight = ($ sharedSecretQrCodeProvider ->getQrCode ()->getHeight () + 2 * QrCodeRendererPng::MARGIN ) * $ blockSize ;
71
64
$ imageSize = getimagesize ($ qrCodeOutputPath );
72
- $ this ->assertEquals ($ symbolWidth , $ imageSize [0 ]);
73
- $ this ->assertEquals ($ symbolHeight , $ imageSize [1 ]);
65
+ $ this ->assertEquals ($ sharedSecretQrCodeProvider -> getQrRenderer ()-> getWidth () , $ imageSize [0 ]);
66
+ $ this ->assertEquals ($ sharedSecretQrCodeProvider -> getQrRenderer ()-> getHeight () , $ imageSize [1 ]);
74
67
75
68
// Remove test QR code output file
76
69
unlink ($ qrCodeOutputPath );
@@ -93,12 +86,9 @@ public function testHotpProvideQrCode()
93
86
$ this ->assertFileExists ($ qrCodeOutputPath );
94
87
95
88
// Test QR code output file mesaurement
96
- $ blockSize = ceil (1000 / ($ sharedSecretQrCodeProvider ->getQrCode ()->getWidth () + 2 * QrCodeRendererPng::MARGIN ));
97
- $ symbolWidth = ($ sharedSecretQrCodeProvider ->getQrCode ()->getWidth () + 2 * QrCodeRendererPng::MARGIN ) * $ blockSize ;
98
- $ symbolHeight = ($ sharedSecretQrCodeProvider ->getQrCode ()->getHeight () + 2 * QrCodeRendererPng::MARGIN ) * $ blockSize ;
99
89
$ imageSize = getimagesize ($ qrCodeOutputPath );
100
- $ this ->assertEquals ($ symbolWidth , $ imageSize [0 ]);
101
- $ this ->assertEquals ($ symbolHeight , $ imageSize [1 ]);
90
+ $ this ->assertEquals ($ sharedSecretQrCodeProvider -> getQrRenderer ()-> getWidth () , $ imageSize [0 ]);
91
+ $ this ->assertEquals ($ sharedSecretQrCodeProvider -> getQrRenderer ()-> getHeight () , $ imageSize [1 ]);
102
92
103
93
// Remove test QR code output file
104
94
unlink ($ qrCodeOutputPath );
@@ -121,12 +111,9 @@ public function testTotpProvideQrCode()
121
111
$ this ->assertFileExists ($ qrCodeOutputPath );
122
112
123
113
// Test QR code output file mesaurement
124
- $ blockSize = ceil (1000 / ($ sharedSecretQrCodeProvider ->getQrCode ()->getWidth () + 2 * QrCodeRendererPng::MARGIN ));
125
- $ symbolWidth = ($ sharedSecretQrCodeProvider ->getQrCode ()->getWidth () + 2 * QrCodeRendererPng::MARGIN ) * $ blockSize ;
126
- $ symbolHeight = ($ sharedSecretQrCodeProvider ->getQrCode ()->getHeight () + 2 * QrCodeRendererPng::MARGIN ) * $ blockSize ;
127
114
$ imageSize = getimagesize ($ qrCodeOutputPath );
128
- $ this ->assertEquals ($ symbolWidth , $ imageSize [0 ]);
129
- $ this ->assertEquals ($ symbolHeight , $ imageSize [1 ]);
115
+ $ this ->assertEquals ($ sharedSecretQrCodeProvider -> getQrRenderer ()-> getWidth () , $ imageSize [0 ]);
116
+ $ this ->assertEquals ($ sharedSecretQrCodeProvider -> getQrRenderer ()-> getHeight () , $ imageSize [1 ]);
130
117
131
118
// Remove test QR code output file
132
119
unlink ($ qrCodeOutputPath );
0 commit comments