testCheckCodeInvalidUsedThrowException()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Tests\TopMcFrance\Api;
4
5
use PHPUnit\Framework\TestCase;
6
use TopMcFrance\Api\VoteChecker;
7
use TopMcFrance\Api\ApiException;
8
9
/**
10
 * @author Jérôme Desjardins <[email protected]>
11
 */
12
class VoteCheckerTest extends TestCase
13
{
14
    
15
    public function testCheckGoodCodeReturnTrue()
16
    {
17
        $vote = new VoteChecker(0);
18
        $this->assertTrue($vote->checkCode('istrue'));
19
    }
20
    
21
    public function testCheckCodeAlreadyUsedThrowException()
22
    {
23
        $this->expectException(ApiException::class);
24
        $this->expectExceptionMessage('Code alreadyused has already used at 0000-00-00 00:00:00');
25
        
26
        $vote = new VoteChecker(0);
27
        $vote->checkCode('alreadyused');
28
    }
29
    
30
     public function testCheckCodeInvalidUsedThrowException()
31
    {
32
        $this->expectException(ApiException::class);
33
        $this->expectExceptionMessage('Code invalidcode isn\'t valid.');
34
        
35
        $vote = new VoteChecker(0);
36
        $vote->checkCode('invalidcode');
37
        
38
        
39
    } 
40
}
41