1 | <?php |
||
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) { |
||
22 | return [ |
||
23 | new FlystemProvider(new DiskResolverCollection) |
||
24 | ]; |
||
25 | }); |
||
26 | |||
27 | $component = Component::custom(new DefaultFolderStructure('/')); |
||
28 | |||
29 | $this->assertEquals('custom', $component->getImplementation()); |
||
30 | $this->assertInstanceOf(Component::class, $component); |
||
31 | $this->assertCount(1, $component->getProviders()); |
||
32 | } |
||
33 | } |
||
34 |