ToggleButtonGroup::TYPE_CHECKBOX, 'model' => new ToggleButtonGroupTestModel(), 'attribute' => 'value', 'items' => [ '1' => 'item 1', '2' => 'item 2', ], ]); $expectedHtml = <<
HTML; $this->assertEqualsWithoutLE($expectedHtml, $html); } /** */ public function testCheckboxChecked() { Html::$counter = 0; $html = ToggleButtonGroup::widget([ 'type' => ToggleButtonGroup::TYPE_CHECKBOX, 'model' => new ToggleButtonGroupTestModel(['value' => '2']), 'attribute' => 'value', 'items' => [ '1' => 'item 1', '2' => 'item 2', ], ]); $this->assertStringContainsString('', $html); } public function testRadio() { Html::$counter = 0; $html = ToggleButtonGroup::widget([ 'type' => ToggleButtonGroup::TYPE_RADIO, 'model' => new ToggleButtonGroupTestModel(), 'attribute' => 'value', 'items' => [ '1' => 'item 1', '2' => 'item 2', ], ]); $expectedHtml = << HTML; $this->assertEqualsWithoutLE($expectedHtml, $html); } /** */ public function testRadioChecked() { Html::$counter = 0; $html = ToggleButtonGroup::widget([ 'type' => ToggleButtonGroup::TYPE_RADIO, 'model' => new ToggleButtonGroupTestModel(['value' => '2']), 'attribute' => 'value', 'items' => [ '1' => 'item 1', '2' => 'item 2', ], ]); $this->assertStringContainsString('', $html); } } class ToggleButtonGroupTestModel extends Model { public $value; }