DMSUploadFieldTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 47
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testDmsUploadFieldIsInjectable() 0 4 1
A testValidatorAlwaysReturnsTrue() 0 4 1
A testGetItemHandler() 0 4 1
A testCanGetAndSetFolderName() 0 7 1
1
<?php
2
3
class DMSUploadFieldTest extends SapphireTest
4
{
5
    /**
6
     * @var DMSUploadField
7
     */
8
    protected $field;
9
10
    public function setUp()
11
    {
12
        parent::setUp();
13
14
        $this->field = new DMSUploadField('StubUploadField');
15
    }
16
17
    /**
18
     * SS 3.x injector will return an overloaded parent of a child class if the child is not injected.
19
     * This is a sanity check.
20
     */
21
    public function testDmsUploadFieldIsInjectable()
22
    {
23
        $this->assertInstanceOf('DMSUploadField', DMSUploadField::create('Stub'));
0 ignored issues
show
Bug introduced by
The method assertInstanceOf() does not seem to exist on object<DMSUploadFieldTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
24
    }
25
26
    /**
27
     * The validator is coded to always return true. Replace this test if this behaviour changes in future.
28
     */
29
    public function testValidatorAlwaysReturnsTrue()
30
    {
31
        $this->assertTrue($this->field->validate('foo'));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DMSUploadFieldTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
    }
33
34
    public function testGetItemHandler()
35
    {
36
        $this->assertInstanceOf('DMSUploadField_ItemHandler', $this->field->getItemHandler(123));
0 ignored issues
show
Bug introduced by
The method assertInstanceOf() does not seem to exist on object<DMSUploadFieldTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
    }
38
39
    /**
40
     * Ensure that the folder name can be get/set and that the value set is casted to a string
41
     */
42
    public function testCanGetAndSetFolderName()
43
    {
44
        $this->field->setFolderName('qwerty');
45
        $this->assertSame('qwerty', $this->field->getFolderName());
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<DMSUploadFieldTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
        $this->field->setFolderName(123);
47
        $this->assertSame('123', $this->field->getFolderName());
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<DMSUploadFieldTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
48
    }
49
}
50