QwertyConvertorTest::testAzertyConversion()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
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