/
ProxyFailureTest.php
64 lines (51 loc) · 1.55 KB
/
ProxyFailureTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
declare(strict_types=1);
namespace SimpleSAML\CAS\Test\XML\cas;
use DOMDocument;
use PHPUnit\Framework\TestCase;
use SimpleSAML\CAS\Constants as C;
use SimpleSAML\CAS\XML\cas\ProxyFailure;
use SimpleSAML\Test\XML\SerializableElementTestTrait;
use SimpleSAML\XML\DOMDocumentFactory;
use function dirname;
use function strval;
/**
* Class \SimpleSAML\CAS\XML\cas\ProxyFailureTest
*
* @covers \SimpleSAML\CAS\XML\cas\ProxyFailure
* @covers \SimpleSAML\CAS\XML\cas\AbstractResponse
* @covers \SimpleSAML\CAS\XML\cas\AbstractCasElement
*
* @package simplesamlphp/cas
*/
final class ProxyFailureTest extends TestCase
{
use SerializableElementTestTrait;
/**
*/
protected function setUp(): void
{
$this->testedClass = ProxyFailure::class;
$this->xmlRepresentation = DOMDocumentFactory::fromFile(
dirname(dirname(dirname(__FILE__))) . '/resources/xml/cas_proxyFailure.xml',
);
}
/**
*/
public function testMarshalling(): void
{
$proxyFailure = new ProxyFailure('some text', C::ERR_INVALID_REQUEST);
$this->assertEquals(
$this->xmlRepresentation->saveXML($this->xmlRepresentation->documentElement),
strval($proxyFailure),
);
}
/**
*/
public function testUnmarshalling(): void
{
$proxyFailure = ProxyFailure::fromXML($this->xmlRepresentation->documentElement);
$this->assertEquals('some text', $proxyFailure->getContent());
$this->assertEquals(C::ERR_INVALID_REQUEST, $proxyFailure->getCode());
}
}