/
AbstractAssertionActionTest.php
48 lines (39 loc) · 1.49 KB
/
AbstractAssertionActionTest.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
<?php
namespace LightSaml\Tests\Action\Assertion;
use LightSaml\Action\Assertion\AbstractAssertionAction;
use LightSaml\Context\ContextInterface;
use LightSaml\Context\Profile\AssertionContext;
use LightSaml\Tests\BaseTestCase;
class AbstractAssertionActionTest extends BaseTestCase
{
public function test_constructs_with_logger()
{
$this->getAbstractAssertionActionMock([$this->getLoggerMock()]);
$this->assertTrue(true);
}
public function test_do_execute_called_with_assertion_context()
{
$action = $this->getAbstractAssertionActionMock([$this->getLoggerMock()]);
$context = new AssertionContext();
$action->expects($this->once())
->method('doExecute')
->with($context);
$action->execute($context);
}
public function test_throws_context_exception_for_non_assertion_context()
{
$action = $this->getAbstractAssertionActionMock([$this->getLoggerMock()]);
$this->expectException(\LightSaml\Error\LightSamlContextException::class);
$this->expectExceptionMessage("Expected AssertionContext");
$action->execute($this->getMockBuilder(ContextInterface::class)->getMock());
}
/**
* @param array $arguments
*
* @return \PHPUnit_Framework_MockObject_MockObject|AbstractAssertionAction
*/
private function getAbstractAssertionActionMock(array $arguments)
{
return $this->getMockForAbstractClass(AbstractAssertionAction::class, $arguments);
}
}