These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Modules\Block\Tests\Integration; |
||
4 | |||
5 | use Illuminate\Support\Facades\Event; |
||
6 | use Modules\Block\Events\BlockContentIsRendering; |
||
7 | |||
8 | class BlockContentIsRenderingTest extends BaseBlockTest |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
9 | { |
||
10 | /** @test */ |
||
11 | public function it_can_change_final_content() |
||
12 | { |
||
13 | Event::listen(BlockContentIsRendering::class, function (BlockContentIsRendering $event) { |
||
14 | $event->setBody('<strong>' . $event->getOriginal() . '</strong>'); |
||
15 | }); |
||
16 | |||
17 | $block = $this->block->create(['name' => 'testBlock', 'en' => ['body' => 'My Block Body'], 'fr' => ['body' => 'lorem fr']]); |
||
18 | |||
19 | $this->assertEquals('<strong>My Block Body</strong>', $block->body); |
||
20 | } |
||
21 | |||
22 | /** @test */ |
||
23 | public function it_doesnt_alter_content_if_no_listeners() |
||
24 | { |
||
25 | $block = $this->block->create(['name' => 'testBlock', 'en' => ['body' => 'My Block Body'], 'fr' => ['body' => 'lorem fr']]); |
||
26 | |||
27 | $this->assertEquals('My Block Body', $block->body); |
||
28 | } |
||
29 | } |
||
30 |