|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Firesphere\YubiAuth\Tests; |
|
4
|
|
|
|
|
5
|
|
|
use Firesphere\YubiAuth\Helpers\QwertyConvertor; |
|
6
|
|
|
use PHPUnit_Framework_TestCase; |
|
7
|
|
|
use SilverStripe\Dev\SapphireTest; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class QwertyConvertorTest |
|
11
|
|
|
* |
|
12
|
|
|
* Uses _INVALID_ Yubikey Authentication strings |
|
13
|
|
|
* |
|
14
|
|
|
* @mixin PHPUnit_Framework_TestCase |
|
15
|
|
|
*/ |
|
16
|
|
|
class QwertyConvertorTest extends SapphireTest |
|
17
|
|
|
{ |
|
18
|
|
|
public function testCapitalisationConversion() |
|
19
|
|
|
{ |
|
20
|
|
|
$string = QwertyConvertor::convertString('CCCCCCFINFGRTJHDEITNIRLNGGBICVNNTHETHDLJLCVL'); |
|
21
|
|
|
$this->assertEquals('ccccccfinfgrtjhdeitnirlnggbicvnnthethdljlcvl', $string); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function testDvorakConversion() |
|
25
|
|
|
{ |
|
26
|
|
|
$string = QwertyConvertor::convertString('jjjjjjucbuipyhde.cybcpnbiixcjkbbyd.ydenhnjkn'); |
|
27
|
|
|
$this->assertEquals('ccccccfinfgrtjhdeitnirlnggbicvnnthethdljlcvl', $string); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function testAzertyConversion() |
|
31
|
|
|
{ |
|
32
|
|
|
$string = QwertyConvertor::convertString('ccccccfinfgrtjhdeitnirl°ggbicvnnthethdljlcvl'); |
|
33
|
|
|
$this->assertEquals('vvvvvvfimfgrtjhdeitmirl+Qggnivbmmthethdljlvbl', $string); |
|
34
|
|
|
$string = QwertyConvertor::convertString('ccccccfinfgrtjhdeitnirl¨ggbicvnnthethdljlcvl'); |
|
35
|
|
|
$this->assertEquals('vvvvvvfimfgrtjhdeitmirl+Sggnivbmmthethdljlvbl', $string); |
|
36
|
|
|
$string = QwertyConvertor::convertString('ccccccfinfgrtjhdeitnirl$ggbicvnnthethdljlcvl'); |
|
37
|
|
|
$this->assertEquals('vvvvvvfimfgrtjhdeitmirl]ggnivbmmthethdljlvbl', $string); |
|
38
|
|
|
$string = QwertyConvertor::convertString('ccccccfinfgrtjhdeitnirl$°gb¨cvnnthethdljlcvl'); |
|
39
|
|
|
$this->assertEquals('vvvvvvfimfgrtjhdeitmirl]+Qgn+Svbmmthethdljlvbl', $string); |
|
40
|
|
|
} |
|
41
|
|
|
} |
|
42
|
|
|
|