EntityFieldRegexpFilterTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 14
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testIsFilterValidForScalar() 0 11 1
1
<?php
2
3
namespace Mdiyakov\DoctrineSolrBundle\Tests\Filter\Field;
4
5
use Mdiyakov\DoctrineSolrBundle\Filter\Field\EntityFieldRegexpFilter;
6
7
class EntityFieldRegexpFilterTest extends \PHPUnit_Framework_TestCase
8
{
9
10
    public function testIsFilterValidForScalar()
11
    {
12
        $string = 'abcd 3874';
13
14
        $entity = new \stdClass();
15
        $filter = new EntityFieldRegexpFilter();
16
        $filter->setEntityFieldName('title');
17
18
        $entity->title = $string;
19
        $filter->setEntityFieldValue('/^[a-z]{1,4}\s?[\d]*$/');
20
        $this->assertEquals(true, $filter->isFilterValid($entity));
21
    }
22
}