Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
- name: Remove phpunit-bridge dependency (not yet PHPUnit 10+ compliant)
run: composer remove --dev symfony/phpunit-bridge

- name: Install latest PHPUnit 11
- name: Install latest PHPUnit
run: composer require --dev --prefer-dist 'phpunit/phpunit:>=10'

- name: Run tests
Expand Down
2 changes: 2 additions & 0 deletions src/PantherTestCaseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ protected static function createPantherClient(array $options = [], array $kernel
}
}

// @phpstan-ignore-next-line
if (is_a(self::class, KernelTestCase::class, true)) {
static::bootKernel($kernelOptions); // @phpstan-ignore-line
}
Expand Down Expand Up @@ -247,6 +248,7 @@ protected static function createHttpBrowserClient(array $options = [], array $ke
self::$httpBrowserClient = new HttpBrowserClient(HttpClient::create($httpClientOptions));
}

// @phpstan-ignore-next-line
if (is_a(self::class, KernelTestCase::class, true)) {
static::bootKernel($kernelOptions); // @phpstan-ignore-line
}
Expand Down
2 changes: 2 additions & 0 deletions tests/AssertionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Symfony\Component\Panther\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\AbstractBrowser;

Expand All @@ -32,6 +33,7 @@
/**
* @dataProvider clientFactoryProvider
*/
#[DataProvider('clientFactoryProvider')]

Check failure on line 36 in tests/AssertionsTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testDomCrawlerAssertions(callable $clientFactory): void
{
$this->request($clientFactory, '/basic.html');
Expand Down
31 changes: 26 additions & 5 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Facebook\WebDriver\JavaScriptExecutor;
use Facebook\WebDriver\WebDriver;
use Facebook\WebDriver\WebDriverExpectedCondition;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\BrowserKit\AbstractBrowser;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\BrowserKit\CookieJar as BrowserKitCookieJar;
Expand Down Expand Up @@ -59,6 +60,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]

Check failure on line 63 in tests/ClientTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testWaitFor(string $locator): void
{
$client = self::createPantherClient();
Expand Down Expand Up @@ -86,6 +88,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]

Check failure on line 91 in tests/ClientTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testWaitForVisibility(string $locator): void
{
$client = self::createPantherClient();
Expand All @@ -98,6 +101,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]

Check failure on line 104 in tests/ClientTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testWaitForInvisibility(string $locator): void
{
$client = self::createPantherClient();
Expand All @@ -110,6 +114,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]

Check failure on line 117 in tests/ClientTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testWaitForElementToContain(string $locator): void
{
$client = self::createPantherClient();
Expand All @@ -122,6 +127,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]

Check failure on line 130 in tests/ClientTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testWaitForElementToNotContain(string $locator): void
{
$client = self::createPantherClient();
Expand All @@ -134,6 +140,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]

Check failure on line 143 in tests/ClientTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testWaitForEnabled(string $locator): void
{
$client = self::createPantherClient();
Expand All @@ -146,6 +153,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]

Check failure on line 156 in tests/ClientTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testWaitForDisabled(string $locator): void
{
$client = self::createPantherClient();
Expand All @@ -158,6 +166,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]

Check failure on line 169 in tests/ClientTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testWaitForAttributeToContain(string $locator): void
{
$client = self::createPantherClient();
Expand All @@ -170,6 +179,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]

Check failure on line 182 in tests/ClientTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist.
public function testWaitForAttributeToNotContain(string $locator): void
{
$client = self::createPantherClient();
Expand All @@ -182,6 +192,7 @@
/**
* @dataProvider waitForDataProvider
*/
#[DataProvider('waitForDataProvider')]
public function testWaitForStalenessElement(string $locator): void
{
$client = self::createPantherClient();
Expand Down Expand Up @@ -247,6 +258,7 @@
/**
* @dataProvider waitForExceptionsProvider
*/
#[DataProvider('waitForDataProvider')]
public function testWaitForExceptions(string $method, array $args, string $message): void
{
$this->expectException(TimeoutException::class);
Expand Down Expand Up @@ -282,15 +294,15 @@
const t = document.querySelector(parentArgs[0]).innerText;
callback(t);
}, 100, arguments);
JS
, ['.p-1']);
JS, ['.p-1']);

$this->assertSame('P1', $innerText);
}

/**
* @dataProvider clientFactoryProvider
* @dataProvider clientFactoryProviderWithType
*/
#[DataProvider('clientFactoryProviderWithType')]
public function testGetCrawler(callable $clientFactory, string $type): void
{
$crawler = $this->request($clientFactory, '/basic.html');
Expand Down Expand Up @@ -320,8 +332,9 @@
}

/**
* @dataProvider clientFactoryProvider
* @dataProvider clientFactoryProviderWithType
*/
#[DataProvider('clientFactoryProviderWithType')]
public function testFollowLink(callable $clientFactory, string $type): void
{
/** @var AbstractBrowser $client */
Expand All @@ -340,6 +353,7 @@
/**
* @dataProvider clientFactoryProvider
*/
#[DataProvider('waitForDataProvider')]
public function testSubmitForm(callable $clientFactory): void
{
/** @var AbstractBrowser $client */
Expand Down Expand Up @@ -395,6 +409,7 @@
/**
* @dataProvider clientFactoryProvider
*/
#[DataProvider('waitForDataProvider')]
public function testSubmitFormWithValues(callable $clientFactory): void
{
/** @var AbstractBrowser $client */
Expand All @@ -421,6 +436,7 @@
/**
* @dataProvider clientFactoryProvider
*/
#[DataProvider('waitForDataProvider')]
public function testHistory(callable $clientFactory): void
{
/** @var AbstractBrowser $client */
Expand All @@ -446,8 +462,9 @@
}

/**
* @dataProvider clientFactoryProvider
* @dataProvider clientFactoryProviderWithType
*/
#[DataProvider('clientFactoryProviderWithType')]
public function testCookie(callable $clientFactory, string $type): void
{
/** @var AbstractBrowser $client */
Expand Down Expand Up @@ -500,6 +517,7 @@
/**
* @dataProvider clientFactoryProvider
*/
#[DataProvider('waitForDataProvider')]
public function testServerPort(callable $clientFactory): void
{
$expectedPort = $_SERVER['PANTHER_WEB_SERVER_PORT'] ?? '9080';
Expand All @@ -510,6 +528,7 @@
/**
* @dataProvider clientFactoryProvider
*/
#[DataProvider('waitForDataProvider')]
public function testBrowserProvider(callable $clientFactory): void
{
$client = $clientFactory();
Expand Down Expand Up @@ -599,6 +618,7 @@
/**
* @dataProvider providePrefersReducedMotion
*/
#[DataProvider('waitForDataProvider')]
public function testPrefersReducedMotion(string $browser): void
{
$client = self::createPantherClient(['browser' => $browser]);
Expand All @@ -611,6 +631,7 @@
/**
* @dataProvider providePrefersReducedMotion
*/
#[DataProvider('waitForDataProvider')]
public function testPrefersReducedMotionDisabled(string $browser): void
{
$this->expectException(ElementClickInterceptedException::class);
Expand Down
Loading
Loading