FilesystemLocalAdapterPluginTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
eloc 13
c 2
b 0
f 2
dl 0
loc 24
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testPlugin() 0 22 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 *  This file is part of the Micro framework package.
7
 *
8
 *  (c) Stanislau Komar <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace Micro\Plugin\Filesystem\Adapter\Local\Test\Unit;
15
16
use Micro\Kernel\App\AppKernel;
17
use Micro\Plugin\Filesystem\Adapter\Local\FilesystemLocalAdapterPlugin;
18
use Micro\Plugin\Filesystem\Facade\FilesystemFacadeInterface;
19
use PHPUnit\Framework\TestCase;
20
21
class FilesystemLocalAdapterPluginTest extends TestCase
22
{
23
    public function testPlugin()
24
    {
25
        $kernel = new AppKernel(
26
            [
27
                'MICRO_FS_DEFAULT_TYPE' => 'local',
28
                'MICRO_FS_DEFAULT_ROOT_PATH' => '/tmp/micro/fs',
29
                'MICRO_FS_DEFAULT_LINK_HANDLING' => '1',
30
            ],
31
            [
32
                FilesystemLocalAdapterPlugin::class,
33
            ]
34
        );
35
36
        $kernel->run();
37
        /** @var FilesystemFacadeInterface $facade */
38
        $facade = $kernel->container()->get(FilesystemFacadeInterface::class);
39
        $operator = $facade->createFsOperator('default');
40
41
        $location = 'temporary';
42
        $operator->write($location, 'success');
43
        $this->assertEquals('success', $operator->read($location));
44
        $operator->delete($location);
45
    }
46
}
47