Passed
Pull Request — master (#40)
by Robbie
02:47
created

ResourceFilterTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testForTemplateThrowsExceptionWithNonFormFieldType() 0 6 1
1
<?php
2
3
namespace SilverStripe\CKANRegistry\Tests\Model;
4
5
use InvalidArgumentException;
6
use SilverStripe\CKANRegistry\Model\ResourceFilter;
7
use SilverStripe\Control\HTTPResponse;
8
use SilverStripe\Dev\SapphireTest;
9
10
class ResourceFilterTest extends SapphireTest
11
{
12
    /**
13
     * @expectedException InvalidArgumentException
14
     * @expectedExceptionMessage SilverStripe\Control\HTTPResponse is not a FormField
15
     */
16
    public function testForTemplateThrowsExceptionWithNonFormFieldType()
17
    {
18
        $filter = new ResourceFilter();
19
        $filter->TypeOptions = '{}';
0 ignored issues
show
Bug Best Practice introduced by
The property TypeOptions does not exist on SilverStripe\CKANRegistry\Model\ResourceFilter. Since you implemented __set, consider adding a @property annotation.
Loading history...
20
        $filter->Type = 'SilverStripe\\Control\\HTTPResponse';
0 ignored issues
show
Bug Best Practice introduced by
The property Type does not exist on SilverStripe\CKANRegistry\Model\ResourceFilter. Since you implemented __set, consider adding a @property annotation.
Loading history...
21
        $filter->forTemplate();
22
    }
23
}
24