Completed
Push — master ( c88b01...7482e8 )
by Tim
01:48
created

Negotiate::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 2
dl 0
loc 11
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 $authSource = array();
15
16
    /**
17
     * @var array
18
     */
19
    private $serverVars = array();
20
21
    /**
22
     * @var array
23
     */
24
    private $requestVars = array();
25
26
    /**
27
     * @param TestConfiguration $configuration
28
     * @param TestData $testData
29
     */
30
    public function __construct($configuration, $testData)
31
    {
32
        $authSource = $testData->getInput('authSource');
33
        $this->serverVars = $configuration->getServerVars();
0 ignored issues
show
Bug introduced by
The method getServerVars() does not seem to exist on object<SimpleSAML\Module...itor\TestConfiguration>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
        $this->requestVars = $configuration->getRequestVars();
0 ignored issues
show
Bug introduced by
The method getRequestVars() does not seem to exist on object<SimpleSAML\Module...itor\TestConfiguration>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
36
        assert(is_array($authSource));
37
        $this->authSource = $authSource;
38
39
        parent::__construct($configuration);
40
    }
41
42
    /**
43
     * @return void
44
     */
45
    protected function invokeTestSuite()
46
    {
47
        $input = array(
48
            'keytab' => $this->authSource['keytab'],
49
            'xml' => in_array('xml', get_object_vars($this->requestVars)) ? $this->requestVars->xml : null,
50
            'authorization' => in_array('HTTP_AUTHORIZATION', get_object_vars($this->serverVars)) ? $this->serverVars->HTTP_AUTHORIZATION : null
51
        );
52
        $testData = new TestData($input);
53
54
        $test = new TestCase\AuthSource\Negotiate($this, $testData);
55
        $this->addTest($test);
56
57
        $this->addMessages($test->getMessages());
58
        $this->calculateState();
59
    }
60
}
61