Completed
Push — master ( edb266...3691e2 )
by Patrick
02:32
created

ComponentTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_can_ask_for_flystem_implementation() 0 6 1
A test_can_ask_for_custom_implementation() 0 14 1
1
<?php
2
3
namespace Mosaic\Filesystem\Tests;
4
5
use Mosaic\Common\Conventions\DefaultFolderStructure;
6
use Mosaic\Filesystem\Adapters\Flysystem\DiskResolverCollection;
7
use Mosaic\Filesystem\Component;
8
use Mosaic\Filesystem\Providers\FlystemProvider;
9
10
class ComponentTest extends \PHPUnit_Framework_TestCase
11
{
12
    public function test_can_ask_for_flystem_implementation()
13
    {
14
        $component = Component::flystem(new DefaultFolderStructure('/'));
15
16
        $this->assertInstanceOf(\Mosaic\Filesystem\Adapters\Flysystem\Component::class, $component);
17
    }
18
19
    public function test_can_ask_for_custom_implementation()
20
    {
21
        Component::extend('custom', function ($folder) {
0 ignored issues
show
Unused Code introduced by
The parameter $folder is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
            return [
23
                new FlystemProvider(new DiskResolverCollection)
24
            ];
25
        });
26
27
        $component = Component::custom(new DefaultFolderStructure('/'));
0 ignored issues
show
Bug introduced by
The method custom() does not exist on Mosaic\Filesystem\Component. Did you maybe mean resolveCustom()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
28
29
        $this->assertEquals('custom', $component->getImplementation());
30
        $this->assertInstanceOf(Component::class, $component);
31
        $this->assertCount(1, $component->getProviders());
32
    }
33
}
34