Completed
Push — master ( 2f04be...9682f1 )
by Steevan
01:49 queued 18s
created

GetBacktracesTest::testLimit2()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Steevanb\PhpBacktrace\Tests\DebugBacktrace;
4
5
use PHPUnit\Framework\TestCase;
6
7
class GetBacktracesTest extends TestCase
8
{
9 View Code Duplication
    public function testWithoutArguments()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
    {
11
        $backtraces = \DebugBacktrace::getBacktraces();
12
13
        static::assertInternalType('array', $backtraces);
14
        static::assertCount(
15
            version_compare(PHP_VERSION, '8.0.0', '>=') ? 10 : 11,
16
            $backtraces
17
        );
18
    }
19
20 View Code Duplication
    public function testOffset1()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    {
22
        $backtraces = \DebugBacktrace::getBacktraces(1);
23
24
        static::assertInternalType('array', $backtraces);
25
        static::assertCount(
26
            version_compare(PHP_VERSION, '8.0.0', '>=') ? 9 : 10,
27
            $backtraces
28
        );
29
    }
30
31
    public function testLimit2()
32
    {
33
        // Weird behavior: limit should be 2 to have last backtrace in debug_backtrace()
34
        $backtraces = \DebugBacktrace::getBacktraces(0, 2);
35
36
        static::assertInternalType('array', $backtraces);
37
        static::assertCount(1, $backtraces);
38
    }
39
}
40