Passed
Push — master ( 3bddf7...37f0e3 )
by Max
07:30
created

RegularExpressionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testClassExistence() 0 4 1
A testCreateSearchPatternFunction() 0 10 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
declare(strict_types=1);
4
5
namespace EasyDictionary;
6
7
use PHPUnit\Framework\TestCase;
8
9
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
10
 * @coversDefaultClass \EasyDictionary\RegularExpression
11
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
12
class RegularExpressionTest extends TestCase
13
{
14
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
15
     * @covers \EasyDictionary\RegularExpression
16
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
17
    public function testClassExistence()
18
    {
19
        self::assertTrue(class_exists('\EasyDictionary\RegularExpression'));
20
    }
21
22
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
23
     * @covers ::createSearchPattern
24
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
25
    public function testCreateSearchPatternFunction()
26
    {
27
        self::assertEquals('/(one)/i', RegularExpression::createSearchPattern('one'));
28
        self::assertEquals('/(one)|(two)/i', RegularExpression::createSearchPattern('one,two'));
29
        self::assertEquals('/(one)|(two)/i', RegularExpression::createSearchPattern(['one', 'two']));
30
        self::assertEquals(
31
            '/((\s+)?one(\s+)?)/i',
32
            RegularExpression::createSearchPattern(['one'], true)
33
        );
34
    }
35
}
36