Browse Source

Fixes #14596: Fix event call on init in `yii\widgets\BaseListView`

tags/2.0.13
Alone 7 years ago committed by Alexander Makarov
parent
commit
4b9d7a6bdd
  1. 1
      framework/CHANGELOG.md
  2. 1
      framework/widgets/BaseListView.php
  3. 16
      tests/framework/widgets/ListViewTest.php

1
framework/CHANGELOG.md

@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.13 under development
------------------------
- Bug #14596: Fix event call on init in `yii\widgets\BaseListView` (panchenkodv)
- New #14151: Added `AttributesBehavior` that assigns values specified to one or multiple attributes of an AR object when certain events happen (bscheshirwork)
- Bug #6526: Fixed `yii\db\Command::batchInsert()` casting of double values correctly independent of the locale (cebe, leammas)
- Bug #14542: Ensured only ASCII characters are in CSRF cookie value since binary data causes issues with ModSecurity and some browsers (samdark)

1
framework/widgets/BaseListView.php

@ -113,6 +113,7 @@ abstract class BaseListView extends Widget
*/
public function init()
{
parent::init();
if ($this->dataProvider === null) {
throw new InvalidConfigException('The "dataProvider" property must be set.');
}

16
tests/framework/widgets/ListViewTest.php

@ -7,7 +7,6 @@
namespace yiiunit\framework\widgets;
use Yii;
use yii\data\ArrayDataProvider;
use yii\data\DataProviderInterface;
use yii\widgets\ListView;
@ -245,4 +244,19 @@ HTML
, $out
);
}
/**
* @see https://github.com/yiisoft/yii2/pull/14596
*/
public function testShouldTriggerInitEvent()
{
$initTriggered = false;
$this->getListView([
'on init' => function () use (&$initTriggered) {
$initTriggered = true;
},
'dataProvider' => new ArrayDataProvider(['allModels' => []]),
]);
$this->assertTrue($initTriggered);
}
}

Loading…
Cancel
Save