Completed
Push — master ( 6071cd...4cf164 )
by Mike
02:36
created

TitleNodeTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_it_can_be_created_with_a_title_slug_and_depth() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace phpDocumentor\Guides\Nodes;
6
7
/**
8
 * This file is part of phpDocumentor.
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 *
13
 * @link https://phpdoc.org
14
 */
15
16
use Mockery as m;
17
use Mockery\Adapter\Phpunit\MockeryTestCase;
18
use phpDocumentor\Guides\Environment;
19
20
final class TitleNodeTest extends MockeryTestCase
21
{
22
    public function test_it_can_be_created_with_a_title_slug_and_depth() : void
23
    {
24
        $environment = m::mock(Environment::class);
25
        $environment->shouldReceive('getTitleLetters')->andReturn(['a']);
26
        $environment->shouldReceive('resetAnonymousStack');
27
28
        $titleNode = new SpanNode($environment, 'Raw String');
0 ignored issues
show
Documentation introduced by
$environment is of type object<Mockery\LegacyMockInterface>, but the function expects a object<phpDocumentor\Guides\Environment>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
29
        $node = new TitleNode($titleNode, 1);
30
        $node->setTarget('target');
31
32
        self::assertSame('raw-string', $node->getId());
33
        self::assertSame($titleNode, $node->getValue());
34
        self::assertSame(1, $node->getLevel());
35
        self::assertSame('target', $node->getTarget());
36
    }
37
}
38