Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add getters to private properties, re: #148 #150

Open
wants to merge 5 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/Browser/PantherBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,35 @@

return $this;
}

public function getScreenshotDir(): ?string
{
return $this->screenshotDir;
}

public function getConsoleLogDir(): ?string
{
return $this->consoleLogDir;
}
Comment on lines +231 to +239
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe i'ts time to bump php 8.1, and change these two properties to public readonly?

unfortunately, we can't do this for savedScreenshots / savedConsoleLogs... I really hope https://wiki.php.net/rfc/asymmetric-visibility-v2 will land in PHP some day 🤞


public function getSavedScreenshots(): array

Check failure on line 241 in src/Browser/PantherBrowser.php

View workflow job for this annotation

GitHub Actions / sca / Static Code Analysis

Method Zenstruck\Browser\PantherBrowser::getSavedScreenshots() return type has no value type specified in iterable type array.
tacman marked this conversation as resolved.
Show resolved Hide resolved
{
return $this->savedScreenshots;
}

public function getSavedConsoleLogs(): array

Check failure on line 246 in src/Browser/PantherBrowser.php

View workflow job for this annotation

GitHub Actions / sca / Static Code Analysis

Method Zenstruck\Browser\PantherBrowser::getSavedConsoleLogs() return type has no value type specified in iterable type array.
{
return $this->savedConsoleLogs;
}

public function setScreenshotDir(?string $screenshotDir): void
{
$this->screenshotDir = $screenshotDir;
}

public function setConsoleLogDir(?string $consoleLogDir): void
{
$this->consoleLogDir = $consoleLogDir;
}
Comment on lines +254 to +262
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to mutate these ones, WDYT @kbond?


}
12 changes: 12 additions & 0 deletions tests/PantherBrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ public function can_use_panther_browser_as_typehint(): void
;
}

/**
* @test
*/
public function can_configure_directories(): void
{
$this->browser()->setScreenshotDir($screenshotDir = '/path/to/screenshot');
assert($this->browser()->getScreenshotDir() === $screenshotDir);
tacman marked this conversation as resolved.
Show resolved Hide resolved

$this->browser()->setConsoleLogDir($logDir = '/path/to/consoleLogs');
assert($this->browser()->getScreenshotDir() === $logDir);
}

/**
* @test
*/
Expand Down
Loading