Passed
Push — master ( 64d02f...fbdc2d )
by Tim
03:59
created

Negotiate::invokeTest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace SimpleSAML\Module\monitor\TestSuite\AuthSource;
4
5
use \SimpleSAML\Module\monitor\TestConfiguration as TestConfiguration;
6
use \SimpleSAML\Module\monitor\TestCase as TestCase;
7
use \SimpleSAML\Module\monitor\TestData as TestData;
8
9
final class Negotiate extends \SimpleSAML\Module\monitor\TestSuiteFactory
10
{
11
    /**
12
     * @var array
13
     */
14
    private $authSourceData = array();
15
16
    /**
17
     * @var bool|null
18
     */
19
    private $xml = null;
20
21
    /**
22
     * @var string|null
23
     */
24
    private $authorization = null;
25
26
    /**
27
     * @param TestConfiguration $configuration
28
     * @param TestData $testData
29
     */
30
    public function __construct($configuration, $testData)
31
    {
32
        $authSourceData = $testData->getInput('authSourceData');
33
        $serverVars = $configuration->getServerVars();
34
        $requestVars = $configuration->getRequestVars();
35
36
        assert(is_array($authSourceData));
37
38
        $this->authSourceData = $authSourceData;
39
        $this->authorization = $serverVars->get('HTTP_AUTHORIZATION');
40
        $this->xml = $requestVars->get('xml');
41
        $this->setCategory('SPNEGO authentication source');
42
43
        parent::__construct($configuration);
44
    }
45
46
    /**
47
     * @return void
48
     */
49
    public function invokeTest()
50
    {
51
        $input = array(
52
            'keytab' => $this->authSourceData['keytab'],
53
            'xml' => $this->xml,
54
            'authorization' => $this->authorization
55
        );
56
        $testData = new TestData($input);
57
58
        $test = new TestCase\AuthSource\Negotiate($this, $testData);
59
        $this->addTestResult($test->getTestResult());
60
        $this->setTestResult($test->getTestResult());
61
    }
62
}
63