Completed
Push — master ( 81ce9d...1672d9 )
by Oleg
03:54
created

FileTest::testWrite()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Writer;
5
6
use org\bovigo\vfs\vfsStream;
7
use PHPUnit\Framework\TestCase;
8
use Prophecy\Argument;
9
10
class FileTest extends TestCase
11
{
12
    public function testWrite()
13
    {
14
        $fileNameProvider = $this->prophesize(FileNameProviderInterface::class);
15
        $fileNameProvider->getFileName(Argument::any())->willReturn('src/dummy.php');
16
17
        $root = vfsStream::setup();
18
19
        $writer = new FileWriter($root->url(), $fileNameProvider->reveal());
20
21
        $writer->write('hello');
22
23
        $fName = $root->url() . '/src/dummy.php';
24
        $this->assertFileExists($fName);
25
        $this->assertEquals('hello', file_get_contents($fName));
26
    }
27
}
28