yiisoft /
yii-widgets
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Yiisoft\Yii\Widgets\Tests\Block; |
||
| 6 | |||
| 7 | use PHPUnit\Framework\TestCase; |
||
| 8 | use Yiisoft\Definitions\Exception\CircularReferenceException; |
||
| 9 | use Yiisoft\Definitions\Exception\InvalidConfigException; |
||
| 10 | use Yiisoft\Definitions\Exception\NotInstantiableException; |
||
| 11 | use Yiisoft\Factory\NotFoundException; |
||
| 12 | use Yiisoft\Yii\Widgets\Block; |
||
| 13 | use Yiisoft\Yii\Widgets\Tests\Support\TestTrait; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @psalm-suppress PropertyNotSetInConstructor |
||
| 17 | */ |
||
| 18 | final class BlockTest extends TestCase |
||
| 19 | { |
||
| 20 | use TestTrait; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @throws CircularReferenceException |
||
| 24 | * @throws InvalidConfigException |
||
| 25 | * @throws NotFoundException |
||
| 26 | * @throws NotInstantiableException |
||
| 27 | */ |
||
| 28 | public function testBlock(): void |
||
| 29 | { |
||
| 30 | Block::widget()->id('testme')->begin(); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 31 | echo '<block-testme>'; |
||
| 32 | Block::end(); |
||
| 33 | |||
| 34 | $this->assertStringContainsString('<block-testme>', $this->webView->getBlock('testme')); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @throws CircularReferenceException |
||
| 39 | * @throws InvalidConfigException |
||
| 40 | * @throws NotFoundException |
||
| 41 | * @throws NotInstantiableException |
||
| 42 | */ |
||
| 43 | public function testBlockRenderInPlaceTrue(): void |
||
| 44 | { |
||
| 45 | Block::widget()->id('testme')->renderInPlace()->begin(); |
||
| 46 | echo '<block-testme>'; |
||
| 47 | $html = Block::end(); |
||
| 48 | |||
| 49 | $this->assertStringContainsString('<block-testme>', $html); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |