Completed
Push — master ( cc396e...a9e063 )
by Chad
9s
created

ExceptionWithContextTest::contextIsOptional()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace TraderInteractiveTest\Exceptions;
4
5
use PHPUnit\Framework\TestCase;
6
use TraderInteractive\Exceptions\ExceptionWithContext;
7
8
/**
9
 * @coversDefaultClass \TraderInteractive\Exceptions\ExceptionWithContext
10
 */
11
final class ExceptionWithContextTest extends TestCase
12
{
13
    /**
14
     * @test
15
     * @covers ::getContext
16
     *
17
     * @return void
18
     */
19
    public function contextIsOptional()
20
    {
21
        $this->assertSame([], (new ExceptionWithContext('a message'))->getContext());
22
    }
23
24
    /**
25
     * @test
26
     * @covers ::getContext
27
     *
28
     * @return void
29
     */
30
    public function getContextReturnsExpectedValues()
31
    {
32
        $context = ['foo' => 'bar'];
33
        $this->assertSame($context, (new ExceptionWithContext('a message', $context))->getContext());
34
    }
35
36
    /**
37
     * @test
38
     * @covers ::__construct
39
     *
40
     * @return void
41
     */
42
    public function exceptionInheritsParentProperties()
43
    {
44
        $this->assertSame(2, (new ExceptionWithContext('a message', [], 2))->getCode());
45
    }
46
}
47