Passed
Push — master ( 7f745f...f5786a )
by Thomas
02:48
created

tests/Extension/LeftAndMainExtensionTest.php (1 issue)

assigning incompatible types to properties.

Bug Documentation Minor
1
<?php
2
3
namespace LeKoala\DebugBar\Test\Extension;
4
5
use LeKoala\DebugBar\DebugBar;
6
use LeKoala\DebugBar\Extension\LeftAndMainExtension;
7
use SilverStripe\Dev\SapphireTest;
8
9
class LeftAndMainExtensionTest extends SapphireTest
10
{
11
    /**
12
     * @var LeftAndMainExtension
13
     */
14
    protected $extension;
15
16
    /**
17
     * @var DebugBar\DataCollector\TimeDataCollector
18
     */
19
    protected $timeCollector;
20
21
    public function setUp()
22
    {
23
        parent::setUp();
24
25
        $this->extension = new LeftAndMainExtension;
26
        DebugBar::initDebugBar();
27
        $this->timeCollector = DebugBar::getDebugBar()->getCollector('time');
0 ignored issues
show
Documentation Bug introduced by
It seems like LeKoala\DebugBar\DebugBa...)->getCollector('time') of type DebugBar\DataCollector\DataCollectorInterface is incompatible with the declared type LeKoala\DebugBar\DebugBa...ector\TimeDataCollector of property $timeCollector.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
28
    }
29
30
    public function tearDown()
31
    {
32
        DebugBar::clearDebugBar();
33
34
        parent::tearDown();
35
    }
36
37
    public function testAccessedCms()
38
    {
39
        $this->extension->accessedCMS();
40
        $this->assertFalse($this->timeCollector->hasStartedMeasure('init'));
41
        $this->assertTrue($this->timeCollector->hasStartedMeasure('cms_accessed'));
42
    }
43
44
    public function testInit()
45
    {
46
        $this->extension->init();
47
        $this->assertFalse($this->timeCollector->hasStartedMeasure('cms_accessed'));
48
        $this->assertTrue($this->timeCollector->hasStartedMeasure('cms_init'));
49
    }
50
}
51