DuskVisualDiffTester   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setBrowser() 0 6 1
A createScreenshot() 0 8 1
A setScreenshotOutputPath() 0 6 1
1
<?php
2
3
namespace BeyondCode\VisualDiff;
4
5
use Laravel\Dusk\Browser;
6
7
class DuskVisualDiffTester extends VisualDiffTester
8
{
9
    /** @var Browser */
10
    protected $browser;
11
12
    public function setBrowser(Browser $browser)
13
    {
14
        $this->browser = $browser;
15
16
        return $this;
17
    }
18
19
    protected function createScreenshot()
20
    {
21
        $filename = str_replace('.png', '', $this->getFilename());
22
23
        $this->browser
24
            ->resize($this->currentResolution['width'], $this->currentResolution['height'])
25
            ->screenshot($filename);
26
    }
27
28
    public function setScreenshotOutputPath(string $screenshotOutputPath)
29
    {
30
        parent::setScreenshotOutputPath($screenshotOutputPath);
31
32
        Browser::$storeScreenshotsAt = $screenshotOutputPath;
33
    }
34
}