removed @depends constraints (cause problems with php 8)
This commit is contained in:
parent
3edb6b4b97
commit
520a475f6e
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace yiiunit\extensions\bootstrap5;
|
||||
|
||||
use yii\base\DynamicModel;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\bootstrap5\Accordion;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
@ -110,7 +112,7 @@ class AccordionTest extends TestCase
|
||||
</div>
|
||||
|
||||
HTML
|
||||
, $output);
|
||||
, $output);
|
||||
}
|
||||
|
||||
public function testLabelKeys()
|
||||
@ -131,7 +133,7 @@ HTML
|
||||
'label' => 'Item3',
|
||||
'content' => 'Content3',
|
||||
],
|
||||
'FormField' => $form->field(new DynamicModel(['test']), 'test',['template' => '{input}']),
|
||||
'FormField' => $form->field(new DynamicModel(['test']), 'test', ['template' => '{input}']),
|
||||
]
|
||||
]);
|
||||
|
||||
@ -166,7 +168,7 @@ HTML
|
||||
</div>
|
||||
|
||||
HTML
|
||||
, $output);
|
||||
, $output);
|
||||
}
|
||||
|
||||
public function testExpandOptions()
|
||||
@ -199,15 +201,15 @@ HTML
|
||||
</div>
|
||||
|
||||
HTML
|
||||
, $output);
|
||||
, $output);
|
||||
}
|
||||
|
||||
public function invalidItemsProvider()
|
||||
{
|
||||
return [
|
||||
[ ['content'] ], // only content without label key
|
||||
[ [[]] ], // only content array without label
|
||||
[ [['content' => 'test']] ], // only content array without label
|
||||
[['content']], // only content without label key
|
||||
[[[]]], // only content array without label
|
||||
[[['content' => 'test']]], // only content array without label
|
||||
];
|
||||
}
|
||||
|
||||
@ -257,7 +259,7 @@ HTML
|
||||
</div>
|
||||
|
||||
HTML
|
||||
, $output);
|
||||
, $output);
|
||||
}
|
||||
|
||||
public function testAutoCloseItems()
|
||||
@ -285,7 +287,6 @@ HTML
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testRender
|
||||
*/
|
||||
public function testItemToggleTag()
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace yiiunit\extensions\bootstrap5;
|
||||
|
||||
use Yii;
|
||||
@ -27,57 +28,6 @@ class ActiveFieldDefaultFormCheckTest extends TestCase
|
||||
*/
|
||||
private $_attributeName = 'attributeName';
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
|
||||
$_SERVER['SCRIPT_FILENAME'] = 'index.php';
|
||||
$_SERVER['SCRIPT_NAME'] = 'index.php';
|
||||
|
||||
$this->mockWebApplication([
|
||||
'container' => [
|
||||
'definitions' => [
|
||||
'yii\bootstrap5\ActiveField' => [
|
||||
'checkTemplate' => "<div class=\"form-check\">\n{input}\n{label}\n{error}\n{hint}\n</div>",
|
||||
'radioTemplate' => "<div class=\"form-check\">\n{input}\n{label}\n{error}\n{hint}\n</div>",
|
||||
'checkHorizontalTemplate' => "{beginWrapper}\n<div class=\"form-check\">\n{input}\n{label}\n{error}\n{hint}\n</div>\n{endWrapper}",
|
||||
'radioHorizontalTemplate' => "{beginWrapper}\n<div class=\"form-check\">\n{input}\n{label}\n{error}\n{hint}\n</div>\n{endWrapper}",
|
||||
'checkOptions' => [
|
||||
'class' => ['widget' => 'form-check-input'],
|
||||
'labelOptions' => [
|
||||
'class' => ['widget' => 'form-check-label']
|
||||
],
|
||||
'wrapperOptions' => [
|
||||
'class' => ['widget' => 'form-check']
|
||||
]
|
||||
],
|
||||
'radioOptions' => [
|
||||
'class' => ['widget' => 'form-check-input'],
|
||||
'labelOptions' => [
|
||||
'class' => ['widget' => 'form-check-label']
|
||||
],
|
||||
'wrapperOptions' => [
|
||||
'class' => ['widget' => 'form-check']
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
$this->_helperModel = new DynamicModel(['attributeName']);
|
||||
ob_start();
|
||||
$this->_helperForm = ActiveForm::begin(['action' => '/something']);
|
||||
ActiveForm::end();
|
||||
ob_end_clean();
|
||||
|
||||
$this->_activeField = Yii::createObject([
|
||||
'class' => 'yii\bootstrap5\ActiveField',
|
||||
'form' => $this->_helperForm
|
||||
]);
|
||||
$this->_activeField->model = $this->_helperModel;
|
||||
$this->_activeField->attribute = $this->_attributeName;
|
||||
}
|
||||
|
||||
public function testDefaultCheckboxByConfig()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
@ -238,4 +188,55 @@ HTML;
|
||||
$this->assertContainsWithoutLE($expected2, $out);
|
||||
$this->assertContainsWithoutLE($expected3, $out);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
|
||||
$_SERVER['SCRIPT_FILENAME'] = 'index.php';
|
||||
$_SERVER['SCRIPT_NAME'] = 'index.php';
|
||||
|
||||
$this->mockWebApplication([
|
||||
'container' => [
|
||||
'definitions' => [
|
||||
'yii\bootstrap5\ActiveField' => [
|
||||
'checkTemplate' => "<div class=\"form-check\">\n{input}\n{label}\n{error}\n{hint}\n</div>",
|
||||
'radioTemplate' => "<div class=\"form-check\">\n{input}\n{label}\n{error}\n{hint}\n</div>",
|
||||
'checkHorizontalTemplate' => "{beginWrapper}\n<div class=\"form-check\">\n{input}\n{label}\n{error}\n{hint}\n</div>\n{endWrapper}",
|
||||
'radioHorizontalTemplate' => "{beginWrapper}\n<div class=\"form-check\">\n{input}\n{label}\n{error}\n{hint}\n</div>\n{endWrapper}",
|
||||
'checkOptions' => [
|
||||
'class' => ['widget' => 'form-check-input'],
|
||||
'labelOptions' => [
|
||||
'class' => ['widget' => 'form-check-label']
|
||||
],
|
||||
'wrapperOptions' => [
|
||||
'class' => ['widget' => 'form-check']
|
||||
]
|
||||
],
|
||||
'radioOptions' => [
|
||||
'class' => ['widget' => 'form-check-input'],
|
||||
'labelOptions' => [
|
||||
'class' => ['widget' => 'form-check-label']
|
||||
],
|
||||
'wrapperOptions' => [
|
||||
'class' => ['widget' => 'form-check']
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
$this->_helperModel = new DynamicModel(['attributeName']);
|
||||
ob_start();
|
||||
$this->_helperForm = ActiveForm::begin(['action' => '/something']);
|
||||
ActiveForm::end();
|
||||
ob_end_clean();
|
||||
|
||||
$this->_activeField = Yii::createObject([
|
||||
'class' => 'yii\bootstrap5\ActiveField',
|
||||
'form' => $this->_helperForm
|
||||
]);
|
||||
$this->_activeField->model = $this->_helperModel;
|
||||
$this->_activeField->attribute = $this->_attributeName;
|
||||
}
|
||||
}
|
||||
|
@ -26,25 +26,6 @@ class ActiveFieldTest extends TestCase
|
||||
*/
|
||||
private $attributeName = 'attributeName';
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
|
||||
$_SERVER['SCRIPT_FILENAME'] = "index.php";
|
||||
$_SERVER['SCRIPT_NAME'] = "index.php";
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$this->helperModel = new DynamicModel(['attributeName']);
|
||||
ob_start();
|
||||
$this->helperForm = ActiveForm::begin(['action' => '/something']);
|
||||
ActiveForm::end();
|
||||
ob_end_clean();
|
||||
|
||||
$this->activeField = new ActiveField(['form' => $this->helperForm]);
|
||||
$this->activeField->model = $this->helperModel;
|
||||
$this->activeField->attribute = $this->attributeName;
|
||||
}
|
||||
|
||||
public function testFileInput()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
@ -62,8 +43,6 @@ HTML;
|
||||
$this->assertEqualsWithoutLE($expectedHtml, $html);
|
||||
}
|
||||
|
||||
// Tests :
|
||||
|
||||
public function testRadioList()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
@ -89,6 +68,8 @@ HTML;
|
||||
$this->assertEqualsWithoutLE($expectedHtml, $html);
|
||||
}
|
||||
|
||||
// Tests :
|
||||
|
||||
public function testRadioError()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
@ -257,7 +238,6 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testRadioList
|
||||
*
|
||||
* @see https://github.com/yiisoft/yii2-bootstrap/issues/81
|
||||
*/
|
||||
@ -274,7 +254,6 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCheckboxList
|
||||
*
|
||||
* @see https://github.com/yiisoft/yii2-bootstrap/issues/81
|
||||
*/
|
||||
@ -289,4 +268,23 @@ HTML;
|
||||
|
||||
$this->assertContains('data-attribute="test"', $content);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
|
||||
$_SERVER['SCRIPT_FILENAME'] = "index.php";
|
||||
$_SERVER['SCRIPT_NAME'] = "index.php";
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$this->helperModel = new DynamicModel(['attributeName']);
|
||||
ob_start();
|
||||
$this->helperForm = ActiveForm::begin(['action' => '/something']);
|
||||
ActiveForm::end();
|
||||
ob_end_clean();
|
||||
|
||||
$this->activeField = new ActiveField(['form' => $this->helperForm]);
|
||||
$this->activeField->model = $this->helperModel;
|
||||
$this->activeField->attribute = $this->attributeName;
|
||||
}
|
||||
}
|
||||
|
@ -15,15 +15,6 @@ use yiiunit\extensions\bootstrap5\data\User;
|
||||
class ActiveFormTest extends TestCase
|
||||
{
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
// dirty way to have Request object not throwing exception when running testFormNoRoleAttribute()
|
||||
$_SERVER['REQUEST_URI'] = "index.php";
|
||||
|
||||
parent::setUp();
|
||||
|
||||
}
|
||||
|
||||
public function testDefaultLayout()
|
||||
{
|
||||
ActiveForm::$counter = 0;
|
||||
@ -124,7 +115,6 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testHorizontalLayout
|
||||
*/
|
||||
public function testHorizontalLayoutTemplateOverride()
|
||||
{
|
||||
@ -375,4 +365,13 @@ HTML;
|
||||
|
||||
$this->assertContainsWithoutLE('<div class="alert alert-danger"', $out);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
// dirty way to have Request object not throwing exception when running testFormNoRoleAttribute()
|
||||
$_SERVER['REQUEST_URI'] = "index.php";
|
||||
|
||||
parent::setUp();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testNormalAlert
|
||||
*/
|
||||
public function testDismissibleAlert()
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace yiiunit\extensions\bootstrap5;
|
||||
|
||||
use yii\bootstrap5\Button;
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace yiiunit\extensions\bootstrap5;
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace yiiunit\extensions\bootstrap5;
|
||||
|
||||
|
||||
@ -58,7 +59,6 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testContainerOptions
|
||||
*/
|
||||
public function testCrossfade()
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace yiiunit\extensions\bootstrap5;
|
||||
|
||||
use yii\bootstrap5\Dropdown;
|
||||
|
@ -17,32 +17,6 @@ use yii\helpers\StringHelper;
|
||||
*/
|
||||
class LinkPagerTest extends TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->mockWebApplication([
|
||||
'components' => [
|
||||
'urlManager' => [
|
||||
'scriptUrl' => '/',
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pagination.
|
||||
* @param int $page
|
||||
* @return Pagination
|
||||
*/
|
||||
private function getPagination($page)
|
||||
{
|
||||
$pagination = new Pagination();
|
||||
$pagination->setPage($page);
|
||||
$pagination->totalCount = 500;
|
||||
$pagination->route = 'test';
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
public function testFirstLastPageLabels()
|
||||
{
|
||||
$pagination = $this->getPagination(5);
|
||||
@ -79,7 +53,6 @@ class LinkPagerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testDisabledPageElementOptions
|
||||
*/
|
||||
public function testOverrideDisabledPageElementOptions()
|
||||
{
|
||||
@ -151,4 +124,31 @@ class LinkPagerTest extends TestCase
|
||||
]);
|
||||
$this->assertTrue($initTriggered);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->mockWebApplication([
|
||||
'components' => [
|
||||
'urlManager' => [
|
||||
'scriptUrl' => '/',
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pagination.
|
||||
* @param int $page
|
||||
* @return Pagination
|
||||
*/
|
||||
private function getPagination($page)
|
||||
{
|
||||
$pagination = new Pagination();
|
||||
$pagination->setPage($page);
|
||||
$pagination->totalCount = 500;
|
||||
$pagination->route = 'test';
|
||||
|
||||
return $pagination;
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testBodyOptions
|
||||
*/
|
||||
public function testContainerOptions()
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace yiiunit\extensions\bootstrap5;
|
||||
|
||||
use yii\bootstrap5\Nav;
|
||||
@ -68,9 +69,9 @@ EXPECTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testRender
|
||||
*/
|
||||
public function testNavAndForm() {
|
||||
public function testNavAndForm()
|
||||
{
|
||||
|
||||
NavBar::$counter = 0;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace yiiunit\extensions\bootstrap5;
|
||||
|
||||
use yii\bootstrap5\Nav;
|
||||
@ -10,26 +11,6 @@ use yii\bootstrap5\Nav;
|
||||
*/
|
||||
class NavTest extends TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->mockWebApplication([
|
||||
'components' => [
|
||||
'request' => [
|
||||
'class' => 'yii\web\Request',
|
||||
'scriptUrl' => '/base/index.php',
|
||||
'hostInfo' => 'http://example.com/',
|
||||
'url' => '/base/index.php&r=site%2Fcurrent&id=42'
|
||||
],
|
||||
'urlManager' => [
|
||||
'class' => 'yii\web\UrlManager',
|
||||
'baseUrl' => '/base',
|
||||
'scriptUrl' => '/base/index.php',
|
||||
'hostInfo' => 'http://example.com/',
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testIds()
|
||||
{
|
||||
Nav::$counter = 0;
|
||||
@ -365,4 +346,24 @@ EXPECTED;
|
||||
|
||||
$this->assertEqualsWithoutLE($expected, $out);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->mockWebApplication([
|
||||
'components' => [
|
||||
'request' => [
|
||||
'class' => 'yii\web\Request',
|
||||
'scriptUrl' => '/base/index.php',
|
||||
'hostInfo' => 'http://example.com/',
|
||||
'url' => '/base/index.php&r=site%2Fcurrent&id=42'
|
||||
],
|
||||
'urlManager' => [
|
||||
'class' => 'yii\web\UrlManager',
|
||||
'baseUrl' => '/base',
|
||||
'scriptUrl' => '/base/index.php',
|
||||
'hostInfo' => 'http://example.com/',
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace yiiunit\extensions\bootstrap5;
|
||||
|
||||
|
||||
@ -46,7 +47,6 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testRender
|
||||
*/
|
||||
public function testMultiple()
|
||||
{
|
||||
@ -76,7 +76,7 @@ HTML;
|
||||
public function testRussianLocaleRendering()
|
||||
{
|
||||
$this->mockWebApplication([
|
||||
'language' => 'ru-RU',
|
||||
'language' => 'ru-RU',
|
||||
'sourceLanguage' => 'en-US',
|
||||
]);
|
||||
|
||||
|
@ -152,12 +152,12 @@ class TabsTest extends TestCase
|
||||
Tabs::$counter = 0;
|
||||
$html = Tabs::widget([
|
||||
'items' => [
|
||||
[
|
||||
[
|
||||
'label' => 'Page1',
|
||||
'content' => 'Page1',
|
||||
'disabled' => true
|
||||
],
|
||||
[
|
||||
],
|
||||
[
|
||||
'label' => 'Page2',
|
||||
'content' => 'Page2',
|
||||
],
|
||||
@ -371,7 +371,7 @@ HTML;
|
||||
$this->assertEquals($expected, $html);
|
||||
}
|
||||
|
||||
public function testHeaderOptions()
|
||||
public function testHeaderOptions()
|
||||
{
|
||||
Tabs::$counter = 0;
|
||||
$html = Tabs::widget([
|
||||
|
@ -33,7 +33,6 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testBodyOptions
|
||||
*/
|
||||
public function testContainerOptions()
|
||||
{
|
||||
|
@ -32,9 +32,9 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCheckbox
|
||||
*/
|
||||
public function testCheckboxChecked() {
|
||||
public function testCheckboxChecked()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$html = ToggleButtonGroup::widget([
|
||||
'type' => ToggleButtonGroup::TYPE_CHECKBOX,
|
||||
@ -70,9 +70,9 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testRadio
|
||||
*/
|
||||
public function testRadioChecked() {
|
||||
public function testRadioChecked()
|
||||
{
|
||||
Html::$counter = 0;
|
||||
$html = ToggleButtonGroup::widget([
|
||||
'type' => ToggleButtonGroup::TYPE_RADIO,
|
||||
|
@ -21,7 +21,9 @@ class Singer extends Model
|
||||
[['lastName'], 'default', 'value' => 'Lennon'],
|
||||
[['lastName'], 'required'],
|
||||
[['underscore_style'], 'yii\captcha\CaptchaValidator'],
|
||||
[['test'], 'required', 'when' => function($model) { return $model->firstName === 'cebe'; }],
|
||||
[['test'], 'required', 'when' => function ($model) {
|
||||
return $model->firstName === 'cebe';
|
||||
}],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user