null,
        ]);
    }
    public function testOptionsByArray()
    {
        $column = new RadioButtonColumn([
            'radioOptions' => [
                'value' => 42,
            ],
        ]);
        $this->assertEquals('
 | ', $column->renderDataCell([], 1, 0));
    }
    public function testOptionsByCallback()
    {
        $model = [
            'label' => 'label',
            'value' => 123,
        ];
        $column = new RadioButtonColumn([
            'radioOptions' => function ($model) {
                return [
                    'value' => $model['value'],
                ];
            },
        ]);
        $actual = $column->renderDataCell($model, 1, 0);
        $this->assertEquals(' | ', $actual);
    }
    public function testContent()
    {
        $column = new RadioButtonColumn([
            'content' => function ($model, $key, $index, $column) {
                return null;
            }
        ]);
        $this->assertContains(' | ', $column->renderDataCell([], 1, 0));
        $column = new RadioButtonColumn([
            'content' => function ($model, $key, $index, $column) {
                return Html::radio('radioButtonInput', false);
            }
        ]);
        $this->assertContains(Html::radio('radioButtonInput', false), $column->renderDataCell([], 1, 0));
    }
    public function testMultipleInGrid()
    {
        $this->mockApplication();
        Yii::setAlias('@webroot', '@yiiunit/runtime');
        Yii::setAlias('@web', 'http://localhost/');
        Yii::$app->assetManager->bundles['yii\web\JqueryAsset'] = false;
        Yii::$app->set('request', new Request(['url' => '/abc']));
        $models = [
            ['label' => 'label1', 'value' => 1],
            ['label' => 'label2', 'value' => 2, 'checked' => true],
        ];
        $grid = new GridView([
            'dataProvider' => new ArrayDataProvider(['allModels' => $models]),
            'options' => ['id' => 'radio-gridview'],
            'columns' => [
                [
                    'class' => RadioButtonColumn::className(),
                    'radioOptions' => function ($model) {
                        return [
                            'value' => $model['value'],
                            'checked' => $model['value'] == 2,
                        ];
                    },
                ],
            ],
        ]);
        ob_start();
        $grid->run();
        $actual = ob_get_clean();
        $this->assertEqualsWithoutLE(<<<'HTML'
HTML
            , $actual);
    }
}