Completed
Branch feature-unit-tests (9d0273)
by Tim
01:44
created

Negotiate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A invokeTest() 0 11 1
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 string|null
18
     */
19
    private $authorization = null;
20
21
    /**
22
     * @param TestConfiguration $configuration
23
     * @param TestData $testData
24
     */
25
    public function __construct($configuration, $testData)
26
    {
27
        $authSourceData = $testData->getInputItem('authSourceData');
28
        $serverVars = $configuration->getServerVars();
29
30
        assert(is_array($authSourceData));
31
32
        $this->authSourceData = $authSourceData;
33
        $this->authorization = $serverVars->get('HTTP_AUTHORIZATION');
34
        $this->setCategory('SPNEGO authentication source');
35
36
        parent::__construct($configuration);
37
    }
38
39
    /**
40
     * @return void
41
     */
42
    public function invokeTest()
43
    {
44
        $input = array(
45
            'keytab' => $this->authSourceData['keytab'],
46
            'authorization' => $this->authorization
47
        );
48
        $testData = new TestData($input);
49
50
        $test = new TestCase\AuthSource\Negotiate($testData);
51
        $this->addTestResult($test->getTestResult());
52
        $this->setTestResult($test->getTestResult());
53
    }
54
}
55