Test Failed
Push — master ( 6bff04...e0da10 )
by Lyal
02:14
created

HelpersTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
dl 0
loc 38
c 0
b 0
f 0
rs 10
1
<?php
2
namespace Tests\Unit;
3
4
use Lyal\Checkr\Entities\Resources\AdverseAction;
5
use Lyal\Checkr\Entities\Screenings\SsnTrace;
6
use Tests\UnitTestCase;
7
8
class HelpersTest extends UnitTestCase
9
{
10
    public function testStrReplaceToken()
11
    {
12
        $url = 'http://www.pullrequest.com/:id';
13
        $tokens = ['id' => 'hi'];
14
        $generatedUrl = str_replace_tokens($url, $tokens);
15
16
        $this->assertSame('http://www.pullrequest.com/hi', $generatedUrl);
17
    }
18
19
    public function testResourceOrScreeningValidClassName()
20
    {
21
        $screening = $this->getScreening();
22
        $resource = $this->getResource();
23
24
        $screeningName = checkrEntityClassName('ssn_trace');
25
        $resourceName = checkrEntityClassName('adverse_actions');
26
27
        $this->assertSame('\\' . get_class($screening), $screeningName);
28
        $this->assertSame('\\' . get_class($resource), $resourceName);
29
    }
30
31
    public function testResourceOrScreeningInvalidClassName()
32
    {
33
        // Check for the existence of a random unique id class
34
        $object = checkrEntityClassName(uniqid('', false));
35
        $this->assertFalse($object);
36
    }
37
38
    private function getScreening(array $values = [])
39
    {
40
        return new SsnTrace($values, $this->getClient());
41
    }
42
43
    private function getResource(array $values = [])
44
    {
45
        return new AdverseAction($values, $this->getClient());
46
47
    }
48
}
49
50