Code Duplication    Length = 7-13 lines in 3 locations

tests/Extension/ControllerExtensionTest.php 3 locations

@@ 51-63 (lines=13) @@
48
        });
49
    }
50
51
    public function testOnAfterInit()
52
    {
53
        $this->controller->extend('onAfterInit');
54
55
        DebugBar::withDebugBar(function (\DebugBar\DebugBar $debugbar) {
56
            $timeData = $debugbar->getCollector('time');
57
            $this->assertInstanceOf(TimeDataCollector::class, $timeData);
58
59
            $this->assertFalse($timeData->hasStartedMeasure('cms_init'));
60
            $this->assertFalse($timeData->hasStartedMeasure('init'));
61
            $this->assertTrue($timeData->hasStartedMeasure('handle'));
62
        });
63
    }
64
65
    public function testBeforeCallActionHandler()
66
    {
@@ 71-77 (lines=7) @@
68
        $action = 'someaction';
69
        $this->controller->extend('beforeCallActionHandler', $request, $action);
70
71
        DebugBar::withDebugBar(function (\DebugBar\DebugBar $debugbar) {
72
            $timeData = $debugbar->getCollector('time');
73
            $this->assertInstanceOf(TimeDataCollector::class, $timeData);
74
75
            $this->assertFalse($timeData->hasStartedMeasure('handle'));
76
            $this->assertTrue($timeData->hasStartedMeasure('action'));
77
        });
78
79
        $this->assertTrue($this->controller->beforeCallActionHandlerCalled);
80
    }
@@ 89-95 (lines=7) @@
86
        $result = null;
87
        $this->controller->extend('afterCallActionHandler', $request, $action, $result);
88
89
        DebugBar::withDebugBar(function (\DebugBar\DebugBar $debugbar) {
90
            $timeData = $debugbar->getCollector('time');
91
            $this->assertInstanceOf(TimeDataCollector::class, $timeData);
92
93
            $this->assertFalse($timeData->hasStartedMeasure('action'));
94
            $this->assertTrue($timeData->hasStartedMeasure('after_action'));
95
        });
96
    }
97
}
98