Code Duplication    Length = 34-34 lines in 2 locations

Tests/Units/Exception/ReadExceptionTests.php 1 location

@@ 22-55 (lines=34) @@
19
 *
20
 * @author Ivannis Suárez Jerez <[email protected]>
21
 */
22
class ReadExceptionTests extends TestCase
23
{
24
    /**
25
     * Test class.
26
     */
27
    public function testClass()
28
    {
29
        $this
30
            ->testedClass
31
                ->extends(\RuntimeException::class)
32
        ;
33
    }
34
35
    /*
36
     * Test forException method.
37
     */
38
    public function testForKey()
39
    {
40
        $this
41
            ->given(
42
                $exceptionCode = 10,
43
                $cause = new \Exception('some cause', $exceptionCode)
44
            )
45
            ->when($exception = ReadException::forException($cause))
46
            ->then()
47
                ->object($exception)
48
                    ->isInstanceOf(ReadException::class)
49
                ->integer($exception->getCode())
50
                    ->isEqualTo($exceptionCode)
51
                ->object($exception->getPrevious())
52
                    ->isIdenticalTo($cause)
53
        ;
54
    }
55
}
56

Tests/Units/Exception/WriteExceptionTests.php 1 location

@@ 22-55 (lines=34) @@
19
 *
20
 * @author Ivannis Suárez Jerez <[email protected]>
21
 */
22
class WriteExceptionTests extends TestCase
23
{
24
    /**
25
     * Test class.
26
     */
27
    public function testClass()
28
    {
29
        $this
30
            ->testedClass
31
                ->extends(\RuntimeException::class)
32
        ;
33
    }
34
35
    /*
36
     * Test forException method.
37
     */
38
    public function testForKey()
39
    {
40
        $this
41
            ->given(
42
                $exceptionCode = 10,
43
                $cause = new \Exception('some cause', $exceptionCode)
44
            )
45
            ->when($exception = WriteException::forException($cause))
46
            ->then()
47
                ->object($exception)
48
                    ->isInstanceOf(WriteException::class)
49
                ->integer($exception->getCode())
50
                    ->isEqualTo($exceptionCode)
51
                ->object($exception->getPrevious())
52
                    ->isIdenticalTo($cause)
53
        ;
54
    }
55
}
56