You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
822 B
44 lines
822 B
7 years ago
|
<?php
|
||
|
/**
|
||
|
* @link http://www.yiiframework.com/
|
||
|
* @copyright Copyright (c) 2008 Yii Software LLC
|
||
|
* @license http://www.yiiframework.com/license/
|
||
|
*/
|
||
|
|
||
|
namespace yiiunit\framework\widgets;
|
||
|
|
||
|
use yii\widgets\Block;
|
||
|
|
||
|
/**
|
||
|
* @group widgets
|
||
|
*/
|
||
|
class BlockTest extends \yiiunit\TestCase
|
||
|
{
|
||
|
protected function setUp()
|
||
|
{
|
||
|
parent::setUp();
|
||
|
|
||
|
$this->mockWebApplication();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @see https://github.com/yiisoft/yii2/issues/15536
|
||
|
*/
|
||
|
public function testShouldTriggerInitEvent()
|
||
|
{
|
||
|
$initTriggered = false;
|
||
|
|
||
|
$block = new Block(
|
||
|
[
|
||
|
'on init' => function () use (&$initTriggered) {
|
||
|
$initTriggered = true;
|
||
|
}
|
||
|
]
|
||
|
);
|
||
|
|
||
|
ob_get_clean();
|
||
|
|
||
|
$this->assertTrue($initTriggered);
|
||
|
}
|
||
|
}
|