Completed
Pull Request — master (#433)
by Albin
10:58
created

SafeLocalSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 6 1
A it_is_local_adapter() 0 4 1
A it_computes_path_using_base64() 0 5 1
A it_computes_key_back_using_base64() 0 4 1
1
<?php
2
3
namespace spec\Gaufrette\Adapter\Local;
4
5
use Gaufrette\Adapter\Local\Local;
6
use org\bovigo\vfs\vfsStream;
7
use PhpSpec\ObjectBehavior;
8
9
class SafeLocalSpec extends ObjectBehavior
10
{
11
    function let()
12
    {
13
        vfsStream::setup('test');
14
        vfsStream::copyFromFileSystem(__DIR__.'/MockFilesystem');
15
        $this->beConstructedWith(vfsStream::url('test'));
16
    }
17
18
    function it_is_local_adapter()
19
    {
20
        $this->shouldHaveType(Local::class);
21
    }
22
23
    function it_computes_path_using_base64()
24
    {
25
        rename(vfsStream::url('test/filename'), vfsStream::url('test/'.base64_encode('filename')));
26
        $this->read('filename')->shouldReturn("content\n");
27
    }
28
29
    function it_computes_key_back_using_base64()
30
    {
31
        $this->keys()->shouldReturn(array(base64_decode('dir'), base64_decode('dir/file'), base64_decode('filename')));
32
    }
33
}
34