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

test_can_ask_for_custom_implementation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 14
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 8
nc 1
nop 0
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