BlockContentIsRenderingTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_can_change_final_content() 0 10 1
A it_doesnt_alter_content_if_no_listeners() 0 6 1
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
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