CuttingTest::testBasicEntry()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
use kalanis\kw_forums\Cutting;
4
5
6
class CuttingTest extends CommonTestClass
7
{
8
    /**
9
     * @param int $maxLength
10
     * @param string $expected
11
     * @param string $toCut
12
     * @dataProvider basicCutProvider
13
     */
14
    public function testBasicEntry(int $maxLength, string $expected, string $toCut)
15
    {
16
        $data = new Cutting\Content($maxLength);
17
        $this->assertEquals($expected, $data->setContent($toCut)->process()->getContent());
18
    }
19
20
    public function basicCutProvider()
21
    {
22
        return [
23
            [60, 'qwert ziopa sdfgh jklyx cvbn', 'qwert ziopa sdfgh jklyx cvbn'],
24
            [60, 'qwertziopasdfghjklyxcvbn qwertziopasdfghjklyxcvbn  ...', 'qwertziopasdfghjklyxcvbn qwertziopasdfghjklyxcvbn qwertziopasdfghjklyxcvbn'],
25
            [60, '<a>qwert ziopa</a> <span>sdfgh jklyx cvbn<span> <b>qwert ziopa sdfgh jklyx cvbn </b></span></span> ...', '<a>qwert ziopa</a> <span>sdfgh jklyx cvbn<span> <b>qwert ziopa sdfgh jklyx cvbn qwert</b> ziopa<hr /> sdfgh jklyx</span></span> cvbn'],
26
            [60, 'qwert ziopa <span>sdfgh jklyx cvbn<span style="abc: def"> qwert ziopa sdfgh <b ></b></span></span> ...', 'qwert ziopa <span>sdfgh jklyx cvbn<span style="abc: def"> qwert ziopa sdfgh <b class="ddd hdgdd">jklyx cvbn qwert</b> ziopa<hr /> sdfgh jklyx</span></span> cvbn'],
27
            [60, 'qwert ziopa <hr />sdfgh jklyx cvbn<span style="abc: def"> qwert<b class="ddd "></b></span> ...', 'qwert ziopa <hr />sdfgh jklyx cvbn<span style="abc: def"> qwert<b class="ddd hdgdd"> ziopa sdfgh jklyx cvbn qwert</b> ziopa<hr /> sdfgh jklyx</span></hr> cvbn'],
28
            [60, 'qwert ziopa <hr />sdfgh jklyx cvbn<span style="abc: def"> qwert<b class=\'ddd \'></b></span> ...', 'qwert ziopa <hr />sdfgh jklyx cvbn<span style="abc: def"> qwert<b class=\'ddd hdgdd\'> ziopa sdfgh jklyx cvbn qwert</b> ziopa<hr /> sdfgh jklyx</span></hr> cvbn'],
29
        ];
30
    }
31
}
32