Skip to content

Commit

Permalink
Fix Panther calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Jan 10, 2024
1 parent 32bbc45 commit 340083c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"phpunit/phpunit": "^10.0",
"rector/rector": "^0.19",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/panther": "^2.1",
"symfony/phpunit-bridge": "^6.4|^7.0",
"symplify/easy-coding-standard": "^12.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

namespace SpomkyLabs\PwaBundle\Command\SectionProcessor;

use SpomkyLabs\PwaBundle\Command\Client;
use Facebook\WebDriver\WebDriverDimension;
use SpomkyLabs\PwaBundle\ImageProcessor\ImageProcessor;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Panther\Client;
use function is_int;

final class ApplicationScreenshotsSectionProcessor implements SectionProcessor
Expand All @@ -22,10 +23,10 @@ public function __construct(
#[Autowire('%spomky_labs_pwa.dest%')]
private readonly array $dest,
#[Autowire('@pwa.web_client')]
null|Client $webClient,
null|Client $webClient = null,
private readonly null|ImageProcessor $imageProcessor = null,
) {
if ($webClient === null && class_exists(Client::class)) {
if ($webClient === null && class_exists(Client::class) && class_exists(WebDriverDimension::class)) {
$webClient = Client::createChromeClient();
}
$this->webClient = $webClient;
Expand Down
4 changes: 2 additions & 2 deletions src/Command/SectionProcessor/ScreenshotsProcessorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace SpomkyLabs\PwaBundle\Command\SectionProcessor;

use SpomkyLabs\PwaBundle\Command\Client;
use SpomkyLabs\PwaBundle\Command\WebDriverDimension;
use Facebook\WebDriver\WebDriverDimension;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Panther\Client;

trait ScreenshotsProcessorTrait
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

namespace SpomkyLabs\PwaBundle\Command\SectionProcessor;

use SpomkyLabs\PwaBundle\Command\Client;
use Facebook\WebDriver\WebDriverDimension;
use SpomkyLabs\PwaBundle\ImageProcessor\ImageProcessor;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Panther\Client;
use Symfony\Component\Routing\RouterInterface;

final class Windows10WidgetsSectionProcessor implements SectionProcessor
Expand All @@ -27,7 +28,7 @@ public function __construct(
private readonly null|ImageProcessor $imageProcessor = null,
private readonly null|RouterInterface $router = null,
) {
if ($webClient === null && class_exists(Client::class)) {
if ($webClient === null && class_exists(Client::class) && class_exists(WebDriverDimension::class)) {
$webClient = Client::createChromeClient();
}
$this->webClient = $webClient;
Expand Down

0 comments on commit 340083c

Please sign in to comment.