'/some-action',
'layout' => ActiveForm::LAYOUT_DEFAULT
]);
echo $form->field($model, 'attributeName');
ActiveForm::end();
$out = ob_get_clean();
$expected = <<
HTML;
$this->assertContainsWithoutLE($expected, $out);
}
public function testHorizontalLayout()
{
Html::$counter = 0;
ActiveForm::$counter = 0;
ob_start();
$model = new DynamicModel(['attributeName', 'checkbox', 'gridRadios']);
$form = ActiveForm::begin([
'action' => '/some-action',
'layout' => ActiveForm::LAYOUT_HORIZONTAL
]);
echo $form->field($model, 'attributeName');
echo $form->field($model, 'checkbox')->checkbox();
echo $form->field($model, 'gridRadios')->radioList([
'option1' => 'First radio',
'option2' => 'Second radio',
'option3' => 'Third radio'
]);
ActiveForm::end();
$out = ob_get_clean();
$expected = <<
HTML;
$expected2 = <<
HTML;
$expected3 = <<
HTML;
$this->assertContainsWithoutLE($expected, $out);
$this->assertContainsWithoutLE($expected2, $out);
$this->assertContainsWithoutLE($expected3, $out);
}
/**
* @depends testHorizontalLayout
*/
public function testHorizontalLayoutTemplateOverride()
{
ActiveForm::$counter = 0;
ob_start();
$model = new DynamicModel(['checkboxName']);
$form = ActiveForm::begin([
'action' => '/some-action',
'layout' => ActiveForm::LAYOUT_HORIZONTAL
]);
echo $form->field($model, 'checkboxName')->checkbox(['template' => "\n{input}\n{label}\n
\n{error}
"]);
ActiveForm::end();
$out = ob_get_clean();
$expected = <<
HTML;
$this->assertContainsWithoutLE($expected, $out);
}
public function testInlineLayout()
{
ActiveForm::$counter = 0;
ob_start();
$model = new DynamicModel(['attributeName', 'selectName', 'checkboxName']);
$form = ActiveForm::begin([
'action' => '/some-action',
'layout' => ActiveForm::LAYOUT_INLINE
]);
echo $form->field($model, 'attributeName');
echo $form->field($model, 'selectName')->listBox([
'1' => 'One',
'2' => 'Two',
'3' => 'Three'
]);
echo $form->field($model, 'checkboxName')->checkbox();
ActiveForm::end();
$out = ob_get_clean();
$expected = <<
HTML;
$expected2 = <<
HTML;
$expected3 = <<
HTML;
$this->assertContainsWithoutLE('