ExceptionWithContextTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 34
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A contextIsOptional() 0 3 1
A getContextReturnsExpectedValues() 0 4 1
A exceptionInheritsParentProperties() 0 3 1
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