EmbedlyBlockTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testWidthAcceptsPercent() 0 6 1
A testWidthSanitisesInvalidValues() 0 6 1
A testWidthAcceptsPx() 0 6 1
1
<?php
2
namespace Chillu\ElementalEmbedlyBlock\Tests\Block;
3
4
use Chillu\ElementalEmbedlyBlock\Block\EmbedlyBlock;
5
use SilverStripe\Dev\SapphireTest;
6
7
class EmbedlyBlockTest extends SapphireTest
8
{
9
    public function testWidthAcceptsPercent()
10
    {
11
        $block = new EmbedlyBlock([
12
            'Width' => '100%'
13
        ]);
14
        $this->assertEquals('100%', $block->getWidthAttribute());
15
    }
16
17
    public function testWidthAcceptsPx()
18
    {
19
        $block = new EmbedlyBlock([
20
            'Width' => '100px'
21
        ]);
22
        $this->assertEquals('100px', $block->getWidthAttribute());
23
    }
24
25
    public function testWidthSanitisesInvalidValues()
26
    {
27
        $block = new EmbedlyBlock([
28
            'Width' => 'invalid'
29
        ]);
30
        $this->assertEquals('', $block->getWidthAttribute());
31
    }
32
}
33