Files
yii2/tests/framework/widgets/ContentDecoratorTest.php
2024-03-20 17:27:20 -03:00

45 lines
947 B
PHP

<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/
namespace yiiunit\framework\widgets;
use yii\widgets\ContentDecorator;
/**
* @group widgets
*/
class ContentDecoratorTest extends \yiiunit\TestCase
{
protected function setUp(): void
{
parent::setUp();
$this->mockWebApplication();
}
/**
* @see https://github.com/yiisoft/yii2/issues/15536
*/
public function testShouldTriggerInitEvent(): void
{
$initTriggered = false;
$contentDecorator = new ContentDecorator(
[
'viewFile' => '@app/views/layouts/base.php',
'on init' => function () use (&$initTriggered): void {
$initTriggered = true;
}
]
);
ob_get_clean();
$this->assertTrue($initTriggered);
}
}