Completed
Push — master ( bde4cf...61750e )
by Daniel
9s
created

FileTextCacheDatabaseTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 16
wmc 1
lcom 0
cbo 3
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testTruncatesByMaxLength() 0 13 1
1
<?php
2
class FileTextCacheDatabaseTest extends SapphireTest
0 ignored issues
show
Coding Style Compatibility introduced by
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...
3
{
4
    public function testTruncatesByMaxLength()
5
    {
6
        Config::nest();
7
        
8
        Config::inst()->update('FileTextCache_Database', 'max_content_length', 5);
9
        $cache = new FileTextCache_Database();
10
        $file = $this->getMock('File', array('write'));
0 ignored issues
show
Bug introduced by
The method getMock() does not seem to exist on object<FileTextCacheDatabaseTest>.

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...
11
        $content = '0123456789';
12
        $cache->save($file, $content);
13
        $this->assertEquals($cache->load($file), '01234');
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<FileTextCacheDatabaseTest>.

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...
14
15
        Config::unnest();
16
    }
17
}
18