Completed
Push — master ( 06692e...f9f56b )
by Robbie
01:45
created

testDmsUploadFieldIsInjectable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
class DMSUploadFieldTest extends SapphireTest
0 ignored issues
show
Coding Style Compatibility introduced by Robbie Averill
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
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 Robbie Averill
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 Robbie Averill
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 Robbie Averill
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 Robbie Averill
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 Robbie Averill
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