Completed
Push — feature/0.7.0 ( 38440f...02d6a4 )
by Ryuichi
07:28
created

FileReaderTest::okReadFromFileObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace WebStream\IO\Test;
3
4
require_once dirname(__FILE__) . '/../InputStream.php';
5
require_once dirname(__FILE__) . '/../File.php';
6
require_once dirname(__FILE__) . '/../FileInputStream.php';
7
require_once dirname(__FILE__) . '/../Reader/InputStreamReader.php';
8
require_once dirname(__FILE__) . '/../Reader/FileReader.php';
9
require_once dirname(__FILE__) . '/../Test/Providers/FileReaderProvider.php';
10
require_once dirname(__FILE__) . '/../Test/Modules/IOException.php';
11
12
use WebStream\IO\File;
13
use WebStream\IO\Reader\FileReader;
14
use WebStream\IO\Test\Providers\FileReaderProvider;
15
16
/**
17
 * FileReaderTest
18
 * @author Ryuichi TANAKA.
19
 * @since 2016/08/18
20
 * @version 0.7
21
 */
22 View Code Duplication
class FileReaderTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
{
24
    use FileReaderProvider;
25
26
    /**
27
     * 正常系
28
     * ファイルパスからファイルが読み込めること
29
     * @test
30
     * @dataProvider readProvider
31
     */
32
    public function okReadFromFilePath($filePath, $result)
33
    {
34
        $reader = new FileReader($filePath);
35
        $this->assertEquals($reader->read(), $result);
36
    }
37
38
    /**
39
     * 正常系
40
     * ファイルオブジェクトからファイルが読み込めること
41
     * @test
42
     * @dataProvider readProvider
43
     */
44
    public function okReadFromFileObject($filePath, $result)
45
    {
46
        $file = new File($filePath);
47
        $reader = new FileReader($file);
48
        $this->assertEquals($reader->read(), $result);
49
    }
50
}
51