Code Duplication    Length = 17-20 lines in 2 locations

tests/Indexer/FileIndexerTest.php 2 locations

@@ 34-50 (lines=17) @@
31
    /**
32
     * The files in the given directory to index should be added to the index during indexing.
33
     */
34
    public function testIndex()
35
    {
36
        $indexer = new FileIndexer();
37
        $indexer->index([
38
            $this->getAssetsDirectory()
39
        ]);
40
        $finder = new Finder();
41
        $finder
42
            ->files()
43
            ->in($this->getAssetsDirectory())
44
        ;
45
46
        foreach ($finder as $fileInfo) {
47
            $this->assertTrue($indexer->has($fileInfo->getRealPath()));
48
            $this->assertInstanceOf(SplFileInfo::class, $indexer->get($fileInfo->getRealPath()));
49
        }
50
    }
51
52
    /**
53
     * The files in the given directory to index should be added to the index during indexing.
@@ 55-74 (lines=20) @@
52
    /**
53
     * The files in the given directory to index should be added to the index during indexing.
54
     */
55
    public function testIndexFilteredByExtensions()
56
    {
57
        $indexer = new FileIndexer();
58
        $indexer->index([
59
            $this->getAssetsDirectory()
60
        ], [
61
            'txt'
62
        ]);
63
        $finder = new Finder();
64
        $finder
65
            ->files()
66
            ->in($this->getAssetsDirectory())
67
            ->name('*.txt')
68
        ;
69
70
        foreach ($finder as $fileInfo) {
71
            $this->assertTrue($indexer->has($fileInfo->getRealPath()));
72
            $this->assertInstanceOf(SplFileInfo::class, $indexer->get($fileInfo->getRealPath()));
73
        }
74
    }
75
76
    /**
77
     * Adding a invalid file should throw an exception.