Completed
Push — master ( 974531...773161 )
by Asif
02:14
created

testRegistrationAndCompileShortcode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php namespace Webwizo\Shortcodes;
2
3
class ShortcodeRegistrationTest extends \TestCase
4
{
5
6
    protected $string = '[b class="bold"]Bold Text[/b]';
7
8
    protected $compiled = '<strong class="bold">Bold Text</strong>';
9
10
    /**
11
     * Setup the test environment.
12
     */
13
    public function setUp()
14
    {
15
        parent::setUp();
16
        $this->shortcode = app()->make('shortcode');
17
    }
18
19
    public function testInstance()
20
    {
21
        $this->assertInstanceOf(\Webwizo\Shortcodes\Shortcode::class, $this->shortcode);
22
    }
23
24
    public function testRegistrationAndCompileShortcode()
25
    {
26
        $this->shortcode->register('b', function($shortcode, $content) {
27
            return sprintf('<strong class="%s">%s</strong>', $shortcode->class, $content);
28
        });
29
30
        $compiled = $this->shortcode->compile($this->string);
31
32
        $this->assertEquals($this->compiled, $compiled);
33
    }
34
35
36
}