tests/ModuleTest.php
/**
     * Making sure debug toolbar does not error
     * in case module ID is not "debug".
     *
     * @see https://github.com/yiisoft/yii2-debug/pull/176/
     */
Making sure debug toolbar does not error
in case module ID is not "debug".


Making sure debug toolbar does not error in case module ID is not " debug " .
public function testToolbarWithCustomModuleID()
    {
        $moduleID = 'my_debug';
        $module = new Module($moduleID);
        $module->allowedIPs = ['*'];
        Yii::$app->setModule($moduleID, $module);
        $module->bootstrap(Yii::$app);
        Yii::getLogger()->dispatcher = $this->getMockBuilder('yii\\log\\Dispatcher')
            ->setMethods(['dispatch'])
            ->getMock();
        $view = Yii::$app->view;
        ob_start();
        $module->renderToolbar(new Event(['sender' => $view]));
        $output = ob_get_clean();
        $this->assertThat($output, $this->logicalOr(
            $this->matches('%Adata-url="/my_debug%A'),
            $this->matches('%Adata-url="/index.php?r=my_debug%A')
        ));
    }
public function testToolbarWithCustomModuleID ( ) { $ moduleID = 'my_debug' ; $ module = new Module ( $ moduleID ) ; $ module -> allowedIPs = [ '*' ] ; Yii :: $ app -> setModule ( $ moduleID , $ module ) ; $ module -> bootstrap ( Yii :: $ app ) ; Yii :: getLogger ( ) -> dispatcher = $ this -> getMockBuilder ( 'yii\\log\\Dispatcher' ) -> setMethods ( [ 'dispatch' ] ) -> getMock ( ) ; $ view = Yii :: $ app -> view ; ob_start ( ) ; $ module -> renderToolbar ( new Event ( [ 'sender' => $ view ] ) ) ; $ output = ob_get_clean ( ) ; $ this -> assertThat ( $ output , $ this -> logicalOr ( $ this -> matches ( '%Adata-url="/my_debug%A' ) , $ this -> matches ( '%Adata-url="/index.php?r=my_debug%A' ) ) ) ; }
Making sure debug toolbar does not error
 in case module ID is not "debug".
Making sure debug toolbar does not error in case module ID is not " debug " .