update
This commit is contained in:
parent
1a4f4d66c9
commit
222037df7d
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yiisoft/yii2-bootstrap5",
|
"name": "x221/yii2-bootstrap5-mod",
|
||||||
"description": "The Twitter Bootstrap v5 extension for the Yii framework",
|
"description": "The Twitter Bootstrap v5 extension for the Yii framework (Mod Version)",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"yii2",
|
"yii2",
|
||||||
"bootstrap",
|
"bootstrap",
|
||||||
@ -9,7 +9,7 @@
|
|||||||
"type": "yii2-extension",
|
"type": "yii2-extension",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/yiisoft/yii2-bootstrap5"
|
"source": "https://git.chenx221.cyou/chenx221/yii2-bootstrap5-mod"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
@ -27,11 +27,11 @@
|
|||||||
"php": ">=7.0",
|
"php": ">=7.0",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"yiisoft/yii2": "^2.0.42",
|
"yiisoft/yii2": "^2.0.42",
|
||||||
"bower-asset/bootstrap": "^5.1.0"
|
"npm-asset/bootstrap": "^5.3.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"yiisoft/yii2-coding-standards": "~2.0",
|
"yiisoft/yii2-coding-standards": "~2.0",
|
||||||
"phpunit/phpunit": "^6.5.14",
|
"phpunit/phpunit": ">=8.5",
|
||||||
"twbs/bootstrap-icons": "^1.7.2"
|
"twbs/bootstrap-icons": "^1.7.2"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<phpunit bootstrap="./tests/bootstrap.php"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./tests/bootstrap.php" colors="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
|
||||||
colors="true"
|
|
||||||
verbose="true"
|
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
stopOnFailure="false">
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Test Suite">
|
<testsuite name="Test Suite">
|
||||||
<directory>./tests</directory>
|
<directory>./tests</directory>
|
||||||
|
@ -19,7 +19,7 @@ class BootstrapAsset extends AssetBundle
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public $sourcePath = '@bower/bootstrap';
|
public $sourcePath = '@npm/bootstrap';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
|
@ -19,7 +19,7 @@ class BootstrapPluginAsset extends AssetBundle
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public $sourcePath = '@bower/bootstrap';
|
public $sourcePath = '@npm/bootstrap';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
|
@ -204,7 +204,7 @@ HTML
|
|||||||
, $output);
|
, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function invalidItemsProvider()
|
public static function invalidItemsProvider()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['content']], // only content without label key
|
[['content']], // only content without label key
|
||||||
@ -215,10 +215,11 @@ HTML
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider invalidItemsProvider
|
* @dataProvider invalidItemsProvider
|
||||||
* @expectedException \yii\base\InvalidConfigException
|
*
|
||||||
*/
|
*/
|
||||||
public function testMissingLabel($items)
|
public function testMissingLabel($items)
|
||||||
{
|
{
|
||||||
|
$this->expectException(\yii\base\InvalidConfigException::class);
|
||||||
Accordion::widget([
|
Accordion::widget([
|
||||||
'items' => $items,
|
'items' => $items,
|
||||||
]);
|
]);
|
||||||
@ -278,12 +279,12 @@ HTML
|
|||||||
$output = Accordion::widget([
|
$output = Accordion::widget([
|
||||||
'items' => $items
|
'items' => $items
|
||||||
]);
|
]);
|
||||||
$this->assertContains('data-bs-parent="', $output);
|
$this->assertStringContainsString('data-bs-parent="', $output);
|
||||||
$output = Accordion::widget([
|
$output = Accordion::widget([
|
||||||
'autoCloseItems' => false,
|
'autoCloseItems' => false,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
]);
|
]);
|
||||||
$this->assertNotContains('data-bs-parent="', $output);
|
$this->assertStringNotContainsString('data-bs-parent="', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -310,8 +311,8 @@ HTML
|
|||||||
'class' => 'custom-toggle',
|
'class' => 'custom-toggle',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$this->assertContains('<h5 class="mb-0"><a type="button" class="custom-toggle" href="#w0-collapse0" ', $output);
|
$this->assertStringContainsString('<h5 class="mb-0"><a type="button" class="custom-toggle" href="#w0-collapse0" ', $output);
|
||||||
$this->assertNotContains('<button', $output);
|
$this->assertStringNotContainsString('<button', $output);
|
||||||
|
|
||||||
$output = Accordion::widget([
|
$output = Accordion::widget([
|
||||||
'items' => $items,
|
'items' => $items,
|
||||||
@ -320,7 +321,7 @@ HTML
|
|||||||
'class' => ['widget' => 'custom-toggle'],
|
'class' => ['widget' => 'custom-toggle'],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$this->assertContains('<h5 class="mb-0"><a type="button" class="custom-toggle" href="#w1-collapse0" ', $output);
|
$this->assertStringContainsString('<h5 class="mb-0"><a type="button" class="custom-toggle" href="#w1-collapse0" ', $output);
|
||||||
$this->assertNotContains('collapse-toggle', $output);
|
$this->assertStringNotContainsString('collapse-toggle', $output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ HTML;
|
|||||||
$this->assertContainsWithoutLE($expected3, $out);
|
$this->assertContainsWithoutLE($expected3, $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
|
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
|
||||||
$_SERVER['SCRIPT_FILENAME'] = 'index.php';
|
$_SERVER['SCRIPT_FILENAME'] = 'index.php';
|
||||||
|
@ -291,7 +291,7 @@ HTML;
|
|||||||
]
|
]
|
||||||
])->render();
|
])->render();
|
||||||
|
|
||||||
$this->assertContains('data-attribute="test"', $content);
|
$this->assertStringContainsString('data-attribute="test"', $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -306,10 +306,10 @@ HTML;
|
|||||||
]
|
]
|
||||||
])->render();
|
])->render();
|
||||||
|
|
||||||
$this->assertContains('data-attribute="test"', $content);
|
$this->assertStringContainsString('data-attribute="test"', $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
|
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
|
||||||
$_SERVER['SCRIPT_FILENAME'] = "index.php";
|
$_SERVER['SCRIPT_FILENAME'] = "index.php";
|
||||||
|
@ -397,7 +397,7 @@ HTML;
|
|||||||
{
|
{
|
||||||
$form = ActiveForm::widget();
|
$form = ActiveForm::widget();
|
||||||
|
|
||||||
$this->assertNotContains('role="form"', $form);
|
$this->assertStringNotContainsString('role="form"', $form);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testErrorSummaryRendering()
|
public function testErrorSummaryRendering()
|
||||||
@ -418,7 +418,7 @@ HTML;
|
|||||||
$this->assertContainsWithoutLE('<div class="alert alert-danger"', $out);
|
$this->assertContainsWithoutLE('<div class="alert alert-danger"', $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
// dirty way to have Request object not throwing exception when running testFormNoRoleAttribute()
|
// dirty way to have Request object not throwing exception when running testFormNoRoleAttribute()
|
||||||
$_SERVER['REQUEST_URI'] = "index.php";
|
$_SERVER['REQUEST_URI'] = "index.php";
|
||||||
|
@ -28,7 +28,7 @@ class ButtonDropdownTest extends TestCase
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains("$containerClass dropup btn-group", $out);
|
$this->assertStringContainsString("$containerClass dropup btn-group", $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDirection()
|
public function testDirection()
|
||||||
|
@ -90,6 +90,6 @@ HTML;
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains('class="carousel slide carousel-fade"', $out);
|
$this->assertStringContainsString('class="carousel slide carousel-fade"', $out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class HtmlTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function dataProviderStaticControl()
|
public static function dataProviderStaticControl()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
|
@ -25,22 +25,22 @@ class LinkPagerTest extends TestCase
|
|||||||
'firstPageLabel' => true,
|
'firstPageLabel' => true,
|
||||||
'lastPageLabel' => true,
|
'lastPageLabel' => true,
|
||||||
]);
|
]);
|
||||||
$this->assertContains('<li class="page-item first"><a class="page-link" href="/?r=test&page=1" data-page="0">1</a></li>', $output);
|
$this->assertStringContainsString('<li class="page-item first"><a class="page-link" href="/?r=test&page=1" data-page="0">1</a></li>', $output);
|
||||||
$this->assertContains('<li class="page-item last"><a class="page-link" href="/?r=test&page=25" data-page="24">25</a></li>', $output);
|
$this->assertStringContainsString('<li class="page-item last"><a class="page-link" href="/?r=test&page=25" data-page="24">25</a></li>', $output);
|
||||||
$output = LinkPager::widget([
|
$output = LinkPager::widget([
|
||||||
'pagination' => $pagination,
|
'pagination' => $pagination,
|
||||||
'firstPageLabel' => 'First',
|
'firstPageLabel' => 'First',
|
||||||
'lastPageLabel' => 'Last',
|
'lastPageLabel' => 'Last',
|
||||||
]);
|
]);
|
||||||
$this->assertContains('<li class="page-item first"><a class="page-link" href="/?r=test&page=1" data-page="0">First</a></li>', $output);
|
$this->assertStringContainsString('<li class="page-item first"><a class="page-link" href="/?r=test&page=1" data-page="0">First</a></li>', $output);
|
||||||
$this->assertContains('<li class="page-item last"><a class="page-link" href="/?r=test&page=25" data-page="24">Last</a></li>', $output);
|
$this->assertStringContainsString('<li class="page-item last"><a class="page-link" href="/?r=test&page=25" data-page="24">Last</a></li>', $output);
|
||||||
$output = LinkPager::widget([
|
$output = LinkPager::widget([
|
||||||
'pagination' => $pagination,
|
'pagination' => $pagination,
|
||||||
'firstPageLabel' => false,
|
'firstPageLabel' => false,
|
||||||
'lastPageLabel' => false,
|
'lastPageLabel' => false,
|
||||||
]);
|
]);
|
||||||
$this->assertNotContains('<li class="page-item first">', $output);
|
$this->assertStringNotContainsString('<li class="page-item first">', $output);
|
||||||
$this->assertNotContains('<li class="page-item last">', $output);
|
$this->assertStringNotContainsString('<li class="page-item last">', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDisabledPageElementOptions()
|
public function testDisabledPageElementOptions()
|
||||||
@ -49,7 +49,7 @@ class LinkPagerTest extends TestCase
|
|||||||
'pagination' => $this->getPagination(0),
|
'pagination' => $this->getPagination(0),
|
||||||
'disabledListItemSubTagOptions' => ['class' => ['foo-bar']],
|
'disabledListItemSubTagOptions' => ['class' => ['foo-bar']],
|
||||||
]);
|
]);
|
||||||
$this->assertContains('<li class="page-item prev disabled"><a class="page-link foo-bar"', $output);
|
$this->assertStringContainsString('<li class="page-item prev disabled"><a class="page-link foo-bar"', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +60,7 @@ class LinkPagerTest extends TestCase
|
|||||||
'pagination' => $this->getPagination(0),
|
'pagination' => $this->getPagination(0),
|
||||||
'disabledListItemSubTagOptions' => ['class' => new ReplaceArrayValue(['foo-bar'])],
|
'disabledListItemSubTagOptions' => ['class' => new ReplaceArrayValue(['foo-bar'])],
|
||||||
]);
|
]);
|
||||||
$this->assertContains('<li class="page-item prev disabled"><a class="foo-bar"', $output);
|
$this->assertStringContainsString('<li class="page-item prev disabled"><a class="foo-bar"', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDisableCurrentPageButton()
|
public function testDisableCurrentPageButton()
|
||||||
@ -70,12 +70,12 @@ class LinkPagerTest extends TestCase
|
|||||||
'pagination' => $pagination,
|
'pagination' => $pagination,
|
||||||
'disableCurrentPageButton' => false,
|
'disableCurrentPageButton' => false,
|
||||||
]);
|
]);
|
||||||
$this->assertContains('<li class="page-item active" aria-current="page"><a class="page-link" href="/?r=test&page=6" data-page="5">6</a></li>', $output);
|
$this->assertStringContainsString('<li class="page-item active" aria-current="page"><a class="page-link" href="/?r=test&page=6" data-page="5">6</a></li>', $output);
|
||||||
$output = LinkPager::widget([
|
$output = LinkPager::widget([
|
||||||
'pagination' => $pagination,
|
'pagination' => $pagination,
|
||||||
'disableCurrentPageButton' => true,
|
'disableCurrentPageButton' => true,
|
||||||
]);
|
]);
|
||||||
$this->assertContains('<li class="page-item active disabled" aria-current="page"><a class="page-link" href="/?r=test&page=6" data-page="5" tabindex="-1">6</a></li>', $output);
|
$this->assertStringContainsString('<li class="page-item active disabled" aria-current="page"><a class="page-link" href="/?r=test&page=6" data-page="5" tabindex="-1">6</a></li>', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOptionsWithTagOption()
|
public function testOptionsWithTagOption()
|
||||||
@ -100,11 +100,11 @@ class LinkPagerTest extends TestCase
|
|||||||
'class' => 'my-class',
|
'class' => 'my-class',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<div class="my-class page-item"><a class="page-link" href="/?r=test&page=3" data-page="2">3</a></div>',
|
'<div class="my-class page-item"><a class="page-link" href="/?r=test&page=3" data-page="2">3</a></div>',
|
||||||
$output
|
$output
|
||||||
);
|
);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<div class="my-class page-item active" aria-current="page"><a class="page-link" href="/?r=test&page=2" data-page="1">2</a></div>',
|
'<div class="my-class page-item active" aria-current="page"><a class="page-link" href="/?r=test&page=2" data-page="1">2</a></div>',
|
||||||
$output
|
$output
|
||||||
);
|
);
|
||||||
@ -125,7 +125,7 @@ class LinkPagerTest extends TestCase
|
|||||||
$this->assertTrue($initTriggered);
|
$this->assertTrue($initTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->mockWebApplication([
|
$this->mockWebApplication([
|
||||||
|
@ -108,7 +108,7 @@ HTML;
|
|||||||
Modal::end();
|
Modal::end();
|
||||||
$out = ob_get_clean();
|
$out = ob_get_clean();
|
||||||
|
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#w0">Launch demo modal</button>',
|
'<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#w0">Launch demo modal</button>',
|
||||||
$out
|
$out
|
||||||
);
|
);
|
||||||
|
@ -46,7 +46,7 @@ EXPECTED;
|
|||||||
'brandUrl' => '/',
|
'brandUrl' => '/',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains('<a class="navbar-brand" href="/"><img src="/images/test.jpg" alt=""></a>', $out);
|
$this->assertStringContainsString('<a class="navbar-brand" href="/"><img src="/images/test.jpg" alt=""></a>', $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBrandImageOptions()
|
public function testBrandImageOptions()
|
||||||
@ -57,7 +57,7 @@ EXPECTED;
|
|||||||
'brandUrl' => '/',
|
'brandUrl' => '/',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains('<a class="navbar-brand" href="/"><img src="/images/test.jpg" alt="test image"></a>', $out);
|
$this->assertStringContainsString('<a class="navbar-brand" href="/"><img src="/images/test.jpg" alt="test image"></a>', $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBrandLink()
|
public function testBrandLink()
|
||||||
@ -67,7 +67,7 @@ EXPECTED;
|
|||||||
'brandUrl' => false,
|
'brandUrl' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains('<a class="navbar-brand" href="/index.php">Yii Framework</a>', $out);
|
$this->assertStringContainsString('<a class="navbar-brand" href="/index.php">Yii Framework</a>', $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBrandSpan()
|
public function testBrandSpan()
|
||||||
@ -77,7 +77,7 @@ EXPECTED;
|
|||||||
'brandUrl' => null,
|
'brandUrl' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains('<span class="navbar-brand">Yii Framework</span>', $out);
|
$this->assertStringContainsString('<span class="navbar-brand">Yii Framework</span>', $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -347,7 +347,7 @@ EXPECTED;
|
|||||||
$this->assertEqualsWithoutLE($expected, $out);
|
$this->assertEqualsWithoutLE($expected, $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->mockWebApplication([
|
$this->mockWebApplication([
|
||||||
'components' => [
|
'components' => [
|
||||||
|
@ -86,7 +86,7 @@ HTML;
|
|||||||
Offcanvas::end();
|
Offcanvas::end();
|
||||||
$out = ob_get_clean();
|
$out = ob_get_clean();
|
||||||
|
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<button type="button" class="btn btn-primary" data-bs-toggle="offcanvas" data-bs-target="#w0" aria-controls="w0">Launch demo offcanvas</button>',
|
'<button type="button" class="btn btn-primary" data-bs-toggle="offcanvas" data-bs-target="#w0" aria-controls="w0">Launch demo offcanvas</button>',
|
||||||
$out
|
$out
|
||||||
);
|
);
|
||||||
|
@ -36,7 +36,8 @@ HTML;
|
|||||||
|
|
||||||
$js = Yii::$app->view->js[View::POS_READY];
|
$js = Yii::$app->view->js[View::POS_READY];
|
||||||
|
|
||||||
$this->assertInternalType(IsType::TYPE_ARRAY, $js);
|
// $this->assertInternalType(IsType::TYPE_ARRAY, $js);
|
||||||
|
$this->assertIsArray($js);
|
||||||
$options = array_shift($js);
|
$options = array_shift($js);
|
||||||
|
|
||||||
$this->assertContainsWithoutLE("(new bootstrap.Popover('#w0', {", $options);
|
$this->assertContainsWithoutLE("(new bootstrap.Popover('#w0', {", $options);
|
||||||
@ -55,7 +56,8 @@ HTML;
|
|||||||
|
|
||||||
$js = Yii::$app->view->js[View::POS_READY];
|
$js = Yii::$app->view->js[View::POS_READY];
|
||||||
|
|
||||||
$this->assertInternalType(IsType::TYPE_ARRAY, $js);
|
// $this->assertInternalType(IsType::TYPE_ARRAY, $js);
|
||||||
|
$this->assertIsArray($js);
|
||||||
$options = array_shift($js);
|
$options = array_shift($js);
|
||||||
|
|
||||||
$this->assertContainsWithoutLE('"content":"\u003Cspan class=\u0022test-content\u0022\u003ETest content\u003C\/span\u003E"', $options);
|
$this->assertContainsWithoutLE('"content":"\u003Cspan class=\u0022test-content\u0022\u003ETest content\u003C\/span\u003E"', $options);
|
||||||
|
@ -140,11 +140,11 @@ class TabsTest extends TestCase
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertNotContains('InvisiblePage', $html);
|
$this->assertStringNotContainsString('InvisiblePage', $html);
|
||||||
$this->assertNotContains('Invisible Page Content', $html);
|
$this->assertStringNotContainsString('Invisible Page Content', $html);
|
||||||
$this->assertNotContains('InvisibleItem', $html);
|
$this->assertStringNotContainsString('InvisibleItem', $html);
|
||||||
$this->assertNotContains('Invisible Item Content', $html);
|
$this->assertStringNotContainsString('Invisible Item Content', $html);
|
||||||
$this->assertNotContains('Invisible External Link', $html);
|
$this->assertStringNotContainsString('Invisible External Link', $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDisabled()
|
public function testDisabled()
|
||||||
@ -179,23 +179,23 @@ class TabsTest extends TestCase
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<li class="nav-item"><a class="nav-link disabled" href="#w0-tab0" data-bs-toggle="tab" role="tab" aria-controls="w0-tab0" aria-disabled="true" tabindex="-1">Page1</a></li>',
|
'<li class="nav-item"><a class="nav-link disabled" href="#w0-tab0" data-bs-toggle="tab" role="tab" aria-controls="w0-tab0" aria-disabled="true" tabindex="-1">Page1</a></li>',
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<li class="nav-item"><a class="nav-link active" href="#w0-tab1" data-bs-toggle="tab" role="tab" aria-controls="w0-tab1" aria-selected="true">Page2</a></li>',
|
'<li class="nav-item"><a class="nav-link active" href="#w0-tab1" data-bs-toggle="tab" role="tab" aria-controls="w0-tab1" aria-selected="true">Page2</a></li>',
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<li class="nav-item"><a class="nav-link disabled" href="#w0-tab2" data-bs-toggle="tab" role="tab" aria-controls="w0-tab2" aria-disabled="true" tabindex="-1">DisabledPage</a></li>',
|
'<li class="nav-item"><a class="nav-link disabled" href="#w0-tab2" data-bs-toggle="tab" role="tab" aria-controls="w0-tab2" aria-disabled="true" tabindex="-1">DisabledPage</a></li>',
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<a class="dropdown-item disabled" href="#w0-dd3-tab1" data-bs-toggle="tab" role="tab" aria-controls="w0-dd3-tab1" aria-disabled="true" tabindex="-1">DisabledItem</a>',
|
'<a class="dropdown-item disabled" href="#w0-dd3-tab1" data-bs-toggle="tab" role="tab" aria-controls="w0-dd3-tab1" aria-disabled="true" tabindex="-1">DisabledItem</a>',
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<a class="dropdown-item disabled" href="/index.php?r=other%2Fdropdown%2Froute" tabindex="-1" aria-disabled="true">Disabled External Link</a>',
|
'<a class="dropdown-item disabled" href="/index.php?r=other%2Fdropdown%2Froute" tabindex="-1" aria-disabled="true">Disabled External Link</a>',
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
@ -220,7 +220,7 @@ class TabsTest extends TestCase
|
|||||||
'renderTabContent' => true,
|
'renderTabContent' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains('<' . $checkTag, $out);
|
$this->assertStringContainsString('<' . $checkTag, $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTabContentOptions()
|
public function testTabContentOptions()
|
||||||
@ -240,8 +240,8 @@ class TabsTest extends TestCase
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains($checkAttribute . '=', $out);
|
$this->assertStringContainsString($checkAttribute . '=', $out);
|
||||||
$this->assertContains($checkValue, $out);
|
$this->assertStringContainsString($checkValue, $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testActivateFirstVisibleTab()
|
public function testActivateFirstVisibleTab()
|
||||||
@ -270,15 +270,15 @@ class TabsTest extends TestCase
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertNotContains(
|
$this->assertStringNotContainsString(
|
||||||
'<li class="nav-item"><a class="nav-link active" href="#mytab-tab0" data-bs-toggle="tab" role="tab" aria-controls="mytab-tab0" aria-selected="true">Tab 1</a></li>',
|
'<li class="nav-item"><a class="nav-link active" href="#mytab-tab0" data-bs-toggle="tab" role="tab" aria-controls="mytab-tab0" aria-selected="true">Tab 1</a></li>',
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
$this->assertNotContains(
|
$this->assertStringNotContainsString(
|
||||||
'<li class="nav-item"><a class="nav-link active" href="#mytab-tab1" data-bs-toggle="tab" role="tab" aria-controls="mytab-tab1" aria-selected="true">Tab 2</a></li>',
|
'<li class="nav-item"><a class="nav-link active" href="#mytab-tab1" data-bs-toggle="tab" role="tab" aria-controls="mytab-tab1" aria-selected="true">Tab 2</a></li>',
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<li class="nav-item"><a class="nav-link active" href="#mytab-tab2" data-bs-toggle="tab" role="tab" aria-controls="mytab-tab2" aria-selected="true">Tab 3</a></li>',
|
'<li class="nav-item"><a class="nav-link active" href="#mytab-tab2" data-bs-toggle="tab" role="tab" aria-controls="mytab-tab2" aria-selected="true">Tab 3</a></li>',
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
@ -309,7 +309,7 @@ class TabsTest extends TestCase
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
$this->assertContains(
|
$this->assertStringContainsString(
|
||||||
'<li class="nav-item"><a class="nav-link active" href="#mytab-tab2" data-bs-toggle="tab" role="tab" aria-controls="mytab-tab2" aria-selected="true">Tab 3</a></li>',
|
'<li class="nav-item"><a class="nav-link active" href="#mytab-tab2" data-bs-toggle="tab" role="tab" aria-controls="mytab-tab2" aria-selected="true">Tab 3</a></li>',
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
@ -336,9 +336,9 @@ class TabsTest extends TestCase
|
|||||||
],
|
],
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
$this->assertContains('<span>encoded</span>', $html);
|
$this->assertStringContainsString('<span>encoded</span>', $html);
|
||||||
$this->assertContains('<span>not encoded</span>', $html);
|
$this->assertStringContainsString('<span>not encoded</span>', $html);
|
||||||
$this->assertContains('<span>not encoded too</span>', $html);
|
$this->assertStringContainsString('<span>not encoded too</span>', $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -403,6 +403,6 @@ HTML;
|
|||||||
<div id="w0-tab1" class="tab-pane"><div>Content 2</div></div></div>
|
<div id="w0-tab1" class="tab-pane"><div>Content 2</div></div></div>
|
||||||
HTML;
|
HTML;
|
||||||
|
|
||||||
$this->assertEquals($expected, $html);
|
$this->assertEqualsWithoutLE($expected, $html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,13 +39,13 @@ class TestCase extends \PHPUnit\Framework\TestCase
|
|||||||
$needle = str_replace("\r\n", "\n", $needle);
|
$needle = str_replace("\r\n", "\n", $needle);
|
||||||
$haystack = str_replace("\r\n", "\n", $haystack);
|
$haystack = str_replace("\r\n", "\n", $haystack);
|
||||||
|
|
||||||
$this->assertContains($needle, $haystack);
|
$this->assertStringContainsString($needle, $haystack);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->mockWebApplication();
|
$this->mockWebApplication();
|
||||||
@ -54,7 +54,7 @@ class TestCase extends \PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
protected function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
$this->destroyApplication();
|
$this->destroyApplication();
|
||||||
|
@ -132,12 +132,13 @@ HTML;
|
|||||||
Toast::end();
|
Toast::end();
|
||||||
$out = ob_get_clean();
|
$out = ob_get_clean();
|
||||||
|
|
||||||
$this->assertInternalType(IsType::TYPE_ARRAY, $toast->clientOptions);
|
$this->assertIsArray($toast->clientOptions);
|
||||||
$this->assertCount(0, $toast->clientOptions);
|
$this->assertCount(0, $toast->clientOptions);
|
||||||
|
|
||||||
$js = Yii::$app->view->js[View::POS_READY];
|
$js = Yii::$app->view->js[View::POS_READY];
|
||||||
|
|
||||||
$this->assertInternalType(IsType::TYPE_ARRAY, $js);
|
// $this->assertInternalType(IsType::TYPE_ARRAY, $js);
|
||||||
|
$this->assertIsArray($js);
|
||||||
$options = array_shift($js);
|
$options = array_shift($js);
|
||||||
|
|
||||||
$this->assertContainsWithoutLE("(new bootstrap.Toast('#w0', {}));", $options);
|
$this->assertContainsWithoutLE("(new bootstrap.Toast('#w0', {}));", $options);
|
||||||
@ -180,7 +181,8 @@ HTML;
|
|||||||
$this->assertArrayHasKey(View::POS_READY, Yii::$app->view->js);
|
$this->assertArrayHasKey(View::POS_READY, Yii::$app->view->js);
|
||||||
$js = Yii::$app->view->js[View::POS_READY];
|
$js = Yii::$app->view->js[View::POS_READY];
|
||||||
|
|
||||||
$this->assertInternalType(IsType::TYPE_ARRAY, $js);
|
// $this->assertInternalType(IsType::TYPE_ARRAY, $js);
|
||||||
|
$this->assertIsArray($js);
|
||||||
$options = array_shift($js);
|
$options = array_shift($js);
|
||||||
|
|
||||||
$this->assertContainsWithoutLE("(new bootstrap.Toast('#w0', {\"delay\":1000}));", $options);
|
$this->assertContainsWithoutLE("(new bootstrap.Toast('#w0', {\"delay\":1000}));", $options);
|
||||||
|
@ -48,7 +48,7 @@ HTML;
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains('<input type="checkbox" id="i1" class="btn-check" name="ToggleButtonGroupTestModel[value][]" value="2" checked autocomplete="off">', $html);
|
$this->assertStringContainsString('<input type="checkbox" id="i1" class="btn-check" name="ToggleButtonGroupTestModel[value][]" value="2" checked autocomplete="off">', $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRadio()
|
public function testRadio()
|
||||||
@ -88,7 +88,7 @@ HTML;
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertContains('<input type="radio" id="i1" class="btn-check" name="ToggleButtonGroupTestModel[value]" value="2" checked autocomplete="off">', $html);
|
$this->assertStringContainsString('<input type="radio" id="i1" class="btn-check" name="ToggleButtonGroupTestModel[value]" value="2" checked autocomplete="off">', $html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ use yii\bootstrap5\Breadcrumbs;
|
|||||||
|
|
||||||
class TranslationTest extends TestCase
|
class TranslationTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->mockWebApplication([
|
$this->mockWebApplication([
|
||||||
'language' => 'de-CH',
|
'language' => 'de-CH',
|
||||||
|
@ -13,7 +13,7 @@ use yii\bootstrap5\ActiveField;
|
|||||||
*/
|
*/
|
||||||
class ExtendedActiveField extends ActiveField
|
class ExtendedActiveField extends ActiveField
|
||||||
{
|
{
|
||||||
public ?array $horizontalCssClasses = [
|
public $horizontalCssClasses = [
|
||||||
'offset' => 'col-md-offset-4',
|
'offset' => 'col-md-offset-4',
|
||||||
'label' => 'col-md-4',
|
'label' => 'col-md-4',
|
||||||
'wrapper' => 'col-md-6',
|
'wrapper' => 'col-md-6',
|
||||||
|
Loading…
Reference in New Issue
Block a user