Code Duplication    Length = 49-51 lines in 2 locations

src/Helpers/WritePHPUnitFile.php 1 location

@@ 5-53 (lines=49) @@
2
3
namespace GD\Helpers;
4
5
class WritePHPUnitFile extends WriteFileBase
6
{
7
8
    public function writeTest($path, $name, $dusk_class_and_methods)
9
    {
10
11
        $this->write_class_name = $name;
12
13
        $this->write_destination_folder_path = $path;
14
15
        $this->checkDestinationTestFolder();
16
17
        $this->convertDuskClassAndMethodsArrayToText($dusk_class_and_methods);
18
19
        $this->saveToFile();
20
    }
21
22
    protected function addParentContent($parent_function)
23
    {
24
        $parent_base = __DIR__ . '/../../stubs/parent.txt';
25
        $this->base = $this->getFilesystem()->get($parent_base);
26
27
        parent::addParentContent($parent_function);
28
    }
29
30
    protected function addSteps(array $steps)
31
    {
32
        $path = __DIR__ . '/../../stubs/step.txt';
33
        $this->step_template = $this->getFilesystem()->get($path);
34
35
        parent::addSteps($steps);
36
    }
37
38
    protected function getAndSetHeaderArea()
39
    {
40
        $path = __DIR__ . '/../../stubs/header.txt';
41
        $this->content = $this->getFilesystem()->get($path);
42
43
        parent::getAndSetHeaderArea();
44
    }
45
46
    protected function getAndSetFooterArea()
47
    {
48
        $path = __DIR__ . '/../../stubs/footer.txt';
49
        $content = $this->getFilesystem()->get($path);
50
51
        $this->dusk_class_and_methods_string = $this->dusk_class_and_methods_string . $content;
52
    }
53
}
54

src/Helpers/WriteBrowserFile.php 1 location

@@ 5-55 (lines=51) @@
2
3
namespace GD\Helpers;
4
5
class WriteBrowserFile extends WriteFileBase
6
{
7
8
    protected $spacing = "    ";
9
10
    public function writeTest($path, $name, $dusk_class_and_methods)
11
    {
12
13
        $this->write_class_name = $name;
14
15
        $this->write_destination_folder_path = $path;
16
17
        $this->checkDestinationTestFolder();
18
19
        $this->convertDuskClassAndMethodsArrayToText($dusk_class_and_methods);
20
21
        $this->saveToFile();
22
    }
23
24
    protected function getAndSetHeaderArea()
25
    {
26
        $path = __DIR__ . '/../../stubs/browser_header.txt';
27
        $this->content = $this->getFilesystem()->get($path);
28
29
        parent::getAndSetHeaderArea();
30
    }
31
32
    protected function getAndSetFooterArea()
33
    {
34
        $path = __DIR__ . '/../../stubs/browser_footer.txt';
35
        $content = $this->getFilesystem()->get($path);
36
37
        $this->dusk_class_and_methods_string = $this->dusk_class_and_methods_string . $content;
38
    }
39
40
    protected function addParentContent($parent_function)
41
    {
42
        $parent_base = __DIR__ . '/../../stubs/browser_parent.txt';
43
        $this->base = $this->getFilesystem()->get($parent_base);
44
45
        parent::addParentContent($parent_function);
46
    }
47
48
    protected function addSteps(array $steps)
49
    {
50
        $path = __DIR__ . '/../../stubs/browser_step.txt';
51
        $this->step_template = $this->getFilesystem()->get($path);
52
53
        parent::addSteps($steps);
54
    }
55
}
56