|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Yiisoft\Yii\Widgets\Tests\Alert; |
|
6
|
|
|
|
|
7
|
|
|
use InvalidArgumentException; |
|
8
|
|
|
use PHPUnit\Framework\TestCase; |
|
9
|
|
|
use Yiisoft\Definitions\Exception\CircularReferenceException; |
|
10
|
|
|
use Yiisoft\Definitions\Exception\InvalidConfigException; |
|
11
|
|
|
use Yiisoft\Definitions\Exception\NotInstantiableException; |
|
12
|
|
|
use Yiisoft\Factory\NotFoundException; |
|
13
|
|
|
use Yiisoft\Yii\Widgets\Alert; |
|
14
|
|
|
use Yiisoft\Yii\Widgets\Tests\Support\TestTrait; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @psalm-suppress PropertyNotSetInConstructor |
|
18
|
|
|
*/ |
|
19
|
|
|
final class ExceptionTest extends TestCase |
|
20
|
|
|
{ |
|
21
|
|
|
use TestTrait; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @throws CircularReferenceException |
|
25
|
|
|
* @throws InvalidConfigException |
|
26
|
|
|
* @throws NotFoundException |
|
27
|
|
|
* @throws NotInstantiableException |
|
28
|
|
|
*/ |
|
29
|
|
|
public function testBodyTag(): void |
|
30
|
|
|
{ |
|
31
|
|
|
$this->expectException(InvalidArgumentException::class); |
|
32
|
|
|
$this->expectExceptionMessage('Body tag must be a string and cannot be empty.'); |
|
33
|
|
|
Alert::widget()->bodyTag(''); |
|
|
|
|
|
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @throws CircularReferenceException |
|
38
|
|
|
* @throws InvalidConfigException |
|
39
|
|
|
* @throws NotFoundException |
|
40
|
|
|
* @throws NotInstantiableException |
|
41
|
|
|
*/ |
|
42
|
|
|
public function testHeaderTag(): void |
|
43
|
|
|
{ |
|
44
|
|
|
$this->expectException(InvalidArgumentException::class); |
|
45
|
|
|
$this->expectExceptionMessage('Header tag must be a string and cannot be empty.'); |
|
46
|
|
|
Alert::widget()->headerTag(''); |
|
|
|
|
|
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|