Completed
Branch proxy (abe564)
by leo
03:38
created

JsonAuthenticationFailureResponseTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 27
rs 10
c 1
b 0
f 1
wmc 2
lcom 1
cbo 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: leo108
5
 * Date: 2016/10/25
6
 * Time: 14:40
7
 */
8
9
namespace Leo108\CAS\Responses;
10
11
use TestCase;
12
13
class JsonAuthenticationFailureResponseTest extends TestCase
14
{
15
    public function testSetFailure()
16
    {
17
        $resp = new JsonAuthenticationFailureResponse();
18
        $resp->setFailure('code1', 'desc1');
19
        $data = $this->getData($resp);
20
        $this->assertEquals(
21
            ['serviceResponse' => ['authenticationFailure' => ['code' => 'code1', 'description' => 'desc1']]],
22
            $data
23
        );
24
25
        $resp->setFailure('code2', 'desc2');
26
        $data = $this->getData($resp);
27
        $this->assertEquals(
28
            ['serviceResponse' => ['authenticationFailure' => ['code' => 'code2', 'description' => 'desc2']]],
29
            $data
30
        );
31
    }
32
33
    protected function getData(JsonAuthenticationFailureResponse $resp)
34
    {
35
        $property = self::getNonPublicProperty($resp, 'data');
36
37
        return $property->getValue($resp);
38
    }
39
}
40