Skip to content

Commit bda07df

Browse files
committed
Raise min version to PHP 7.3, check compatibility PHP 8.3.
1 parent cf7807d commit bda07df

20 files changed

+183
-132
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ trim_trailing_whitespace = true
1212

1313
[*.md]
1414
trim_trailing_whitespace = false
15+
16+
[*.yml]
17+
indent_size = 2

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
],
2525
"minimum-stability": "stable",
2626
"require": {
27-
"php": ">=7.0",
27+
"php": ">=7.3",
2828
"ext-json": "*",
2929
"yiisoft/yii2": "^2.0.42",
3030
"bower-asset/bootstrap": "^5.1.0"
3131
},
3232
"require-dev": {
3333
"yiisoft/yii2-coding-standards": "~2.0",
34-
"phpunit/phpunit": "^6.5.14",
34+
"phpunit/phpunit": "^9.6",
3535
"twbs/bootstrap-icons": "^1.7.2"
3636
},
3737
"suggest": {

phpunit.xml.dist

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<phpunit bootstrap="./tests/bootstrap.php"
3-
colors="true"
4-
verbose="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
stopOnFailure="false">
9-
<testsuites>
10-
<testsuite name="Test Suite">
11-
<directory>./tests</directory>
12-
</testsuite>
13-
</testsuites>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="./tests/bootstrap.php"
5+
colors="true" convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
stopOnFailure="false"
9+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
10+
>
11+
12+
<php>
13+
<ini name="error_reporting" value="-1"/>
14+
</php>
15+
16+
<testsuites>
17+
<testsuite name="Yii2-Bootstrap5">
18+
<directory>./tests</directory>
19+
</testsuite>
20+
</testsuites>
21+
22+
<coverage>
23+
<include>
24+
<directory>./src</directory>
25+
</include>
26+
</coverage>
1427
</phpunit>

tests/AccordionTest.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ public function invalidItemsProvider()
215215

216216
/**
217217
* @dataProvider invalidItemsProvider
218-
* @expectedException \yii\base\InvalidConfigException
219218
*/
220219
public function testMissingLabel($items)
221220
{
222-
Accordion::widget([
223-
'items' => $items,
224-
]);
221+
$this->expectException(InvalidConfigException::class);
222+
$this->expectExceptionMessage("The 'label' option is required.");
223+
224+
Accordion::widget(['items' => $items]);
225225
}
226226

227227
/**
@@ -278,12 +278,12 @@ public function testAutoCloseItems()
278278
$output = Accordion::widget([
279279
'items' => $items
280280
]);
281-
$this->assertContains('data-bs-parent="', $output);
281+
$this->assertStringContainsString('data-bs-parent="', $output);
282282
$output = Accordion::widget([
283283
'autoCloseItems' => false,
284284
'items' => $items
285285
]);
286-
$this->assertNotContains('data-bs-parent="', $output);
286+
$this->assertStringNotContainsString('data-bs-parent="', $output);
287287
}
288288

289289
/**
@@ -310,8 +310,11 @@ public function testItemToggleTag()
310310
'class' => 'custom-toggle',
311311
],
312312
]);
313-
$this->assertContains('<h5 class="mb-0"><a type="button" class="custom-toggle" href="#w0-collapse0" ', $output);
314-
$this->assertNotContains('<button', $output);
313+
$this->assertStringContainsString(
314+
'<h5 class="mb-0"><a type="button" class="custom-toggle" href="#w0-collapse0" ',
315+
$output,
316+
);
317+
$this->assertStringNotContainsString('<button', $output);
315318

316319
$output = Accordion::widget([
317320
'items' => $items,
@@ -320,7 +323,10 @@ public function testItemToggleTag()
320323
'class' => ['widget' => 'custom-toggle'],
321324
],
322325
]);
323-
$this->assertContains('<h5 class="mb-0"><a type="button" class="custom-toggle" href="#w1-collapse0" ', $output);
324-
$this->assertNotContains('collapse-toggle', $output);
326+
$this->assertStringContainsString(
327+
'<h5 class="mb-0"><a type="button" class="custom-toggle" href="#w1-collapse0" ',
328+
$output,
329+
);
330+
$this->assertStringNotContainsString('collapse-toggle', $output);
325331
}
326332
}

tests/ActiveFieldDefaultFormCheckTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ public function testHorizontalLayout()
184184
HTML;
185185

186186

187-
$this->assertContainsWithoutLE($expected, $out);
188-
$this->assertContainsWithoutLE($expected2, $out);
189-
$this->assertContainsWithoutLE($expected3, $out);
187+
$this->assertStringContainsString($expected, $out);
188+
$this->assertStringContainsString($expected2, $out);
189+
$this->assertStringContainsString($expected3, $out);
190190
}
191191

192-
protected function setUp()
192+
protected function setUp(): void
193193
{
194194
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
195195
$_SERVER['SCRIPT_FILENAME'] = 'index.php';

tests/ActiveFieldTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public function testRadioListItemOptions()
291291
]
292292
])->render();
293293

294-
$this->assertContains('data-attribute="test"', $content);
294+
$this->assertStringContainsString('data-attribute="test"', $content);
295295
}
296296

297297
/**
@@ -306,10 +306,10 @@ public function testCheckboxListItemOptions()
306306
]
307307
])->render();
308308

309-
$this->assertContains('data-attribute="test"', $content);
309+
$this->assertStringContainsString('data-attribute="test"', $content);
310310
}
311311

312-
protected function setUp()
312+
protected function setUp(): void
313313
{
314314
// dirty way to have Request object not throwing exception when running testHomeLinkNull()
315315
$_SERVER['SCRIPT_FILENAME'] = "index.php";

tests/ActiveFormTest.php

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public function testDefaultLayout()
3737
</div>
3838
HTML;
3939

40-
41-
$this->assertContainsWithoutLE($expected, $out);
40+
$this->assertStringContainsString($expected, $out);
4241
}
4342

4443
public function testHorizontalLayout()
@@ -109,9 +108,9 @@ public function testHorizontalLayout()
109108
HTML;
110109

111110

112-
$this->assertContainsWithoutLE($expected, $out);
113-
$this->assertContainsWithoutLE($expected2, $out);
114-
$this->assertContainsWithoutLE($expected3, $out);
111+
$this->assertStringContainsString($expected, $out);
112+
$this->assertStringContainsString($expected2, $out);
113+
$this->assertStringContainsString($expected3, $out);
115114
}
116115

117116
/**
@@ -138,7 +137,7 @@ public function testHorizontalLayoutTemplateOverride()
138137
HTML;
139138

140139

141-
$this->assertContainsWithoutLE($expected, $out);
140+
$this->assertStringContainsString($expected, $out);
142141
}
143142

144143
public function testInlineLayout()
@@ -192,10 +191,10 @@ public function testInlineLayout()
192191
HTML;
193192

194193

195-
$this->assertContainsWithoutLE('<form id="w0" class="form-inline"', $out);
196-
$this->assertContainsWithoutLE($expected, $out);
197-
$this->assertContainsWithoutLE($expected2, $out);
198-
$this->assertContainsWithoutLE($expected3, $out);
194+
$this->assertStringContainsString('<form id="w0" class="form-inline"', $out);
195+
$this->assertStringContainsString($expected, $out);
196+
$this->assertStringContainsString($expected2, $out);
197+
$this->assertStringContainsString($expected3, $out);
199198
}
200199

201200
public function testFloatingLayout()
@@ -249,10 +248,10 @@ public function testFloatingLayout()
249248
HTML;
250249

251250

252-
$this->assertContainsWithoutLE('<form id="w0"', $out);
253-
$this->assertContainsWithoutLE($expected, $out);
254-
$this->assertContainsWithoutLE($expected2, $out);
255-
$this->assertContainsWithoutLE($expected3, $out);
251+
$this->assertStringContainsString('<form id="w0"', $out);
252+
$this->assertStringContainsString($expected, $out);
253+
$this->assertStringContainsString($expected2, $out);
254+
$this->assertStringContainsString($expected3, $out);
256255
}
257256

258257
public function testHintRendering()
@@ -304,10 +303,10 @@ public function testHintRendering()
304303
</div>
305304
HTML;
306305

307-
$this->assertContainsWithoutLE($expected, $out);
308-
$this->assertContainsWithoutLE($expected2, $out);
309-
$this->assertContainsWithoutLE($expected3, $out);
310-
$this->assertContainsWithoutLE($expected4, $out);
306+
$this->assertStringContainsString($expected, $out);
307+
$this->assertStringContainsString($expected2, $out);
308+
$this->assertStringContainsString($expected3, $out);
309+
$this->assertStringContainsString($expected4, $out);
311310
}
312311

313312
public function testStaticControlRendering()
@@ -357,9 +356,9 @@ public function testStaticControlRendering()
357356
</div>
358357
HTML;
359358

360-
$this->assertContainsWithoutLE($expected, $out);
361-
$this->assertContainsWithoutLE($expected2, $out);
362-
$this->assertContainsWithoutLE($expected3, $out);
359+
$this->assertStringContainsString($expected, $out);
360+
$this->assertStringContainsString($expected2, $out);
361+
$this->assertStringContainsString($expected3, $out);
363362
}
364363

365364
/**
@@ -387,7 +386,7 @@ public function testInputTemplate()
387386
</div>
388387
HTML;
389388

390-
$this->assertContainsWithoutLE($expected, $out);
389+
$this->assertStringContainsString($expected, $out);
391390
}
392391

393392
/**
@@ -397,7 +396,7 @@ public function testFormNoRoleAttribute()
397396
{
398397
$form = ActiveForm::widget();
399398

400-
$this->assertNotContains('role="form"', $form);
399+
$this->assertStringNotContainsString('role="form"', $form);
401400
}
402401

403402
public function testErrorSummaryRendering()
@@ -415,10 +414,10 @@ public function testErrorSummaryRendering()
415414
$out = ob_get_clean();
416415

417416

418-
$this->assertContainsWithoutLE('<div class="alert alert-danger"', $out);
417+
$this->assertStringContainsString('<div class="alert alert-danger"', $out);
419418
}
420419

421-
protected function setUp()
420+
protected function setUp(): void
422421
{
423422
// dirty way to have Request object not throwing exception when running testFormNoRoleAttribute()
424423
$_SERVER['REQUEST_URI'] = "index.php";

tests/ButtonDropdownTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testContainerOptions()
2828
],
2929
]);
3030

31-
$this->assertContains("$containerClass dropup btn-group", $out);
31+
$this->assertStringContainsString("$containerClass dropup btn-group", $out);
3232
}
3333

3434
public function testDirection()

tests/CarouselTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ public function testCrossfade()
9090
]
9191
]);
9292

93-
$this->assertContains('class="carousel slide carousel-fade"', $out);
93+
$this->assertStringContainsString('class="carousel slide carousel-fade"', $out);
9494
}
9595
}

0 commit comments

Comments
 (0)