Code Duplication    Length = 20-22 lines in 2 locations

tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php 1 location

@@ 61-82 (lines=22) @@
58
    /**
59
     * @inheritdoc
60
     */
61
    public function tearDown()
62
    {
63
        $dirs = [];
64
65
        $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->path));
66
        foreach ($ri AS $file) {
67
            /* @var $file \SplFileInfo */
68
            if ($file->isFile()) {
69
                \unlink($file->getPathname());
70
            } elseif ($file->getBasename() === '.') {
71
                $dirs[] = $file->getRealPath();
72
            }
73
        }
74
75
        arsort($dirs);
76
77
        foreach ($dirs as $dir) {
78
            \rmdir($dir);
79
        }
80
81
        parent::tearDown();
82
    }
83
84
    public function testGenerateRepositories()
85
    {

tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php 1 location

@@ 52-71 (lines=20) @@
49
    /**
50
     * @inheritdoc
51
     */
52
    public function tearDown()
53
    {
54
        $dirs = [];
55
56
        $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->_tmpDir));
57
        foreach ($ri AS $file) {
58
            /* @var $file \SplFileInfo */
59
            if ($file->isFile()) {
60
                \unlink($file->getPathname());
61
            } elseif ($file->getBasename() === '.') {
62
                $dirs[] = $file->getRealPath();
63
            }
64
        }
65
66
        arsort($dirs);
67
68
        foreach ($dirs as $dir) {
69
            \rmdir($dir);
70
        }
71
    }
72
73
    /**
74
     * @group DDC-3231