Skip to content

Commit 484063b

Browse files
committed
replace PHPUnit annotations with attributes
1 parent e68f766 commit 484063b

File tree

5 files changed

+14
-24
lines changed

5 files changed

+14
-24
lines changed

Tests/AbstractBrowserTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\BrowserKit\Tests;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
15+
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
1416
use PHPUnit\Framework\TestCase;
1517
use Symfony\Component\BrowserKit\CookieJar;
1618
use Symfony\Component\BrowserKit\Exception\BadMethodCallException;
@@ -650,9 +652,7 @@ public function testFollowRedirectDropPostMethod()
650652
}
651653
}
652654

653-
/**
654-
* @dataProvider getTestsForMetaRefresh
655-
*/
655+
#[DataProvider('getTestsForMetaRefresh')]
656656
public function testFollowMetaRefresh(string $content, string $expectedEndingUrl, bool $followMetaRefresh = true)
657657
{
658658
$client = $this->getBrowser();
@@ -776,9 +776,7 @@ public function testRestart()
776776
$this->assertSame([], $client->getCookieJar()->all(), '->restart() clears the cookies');
777777
}
778778

779-
/**
780-
* @runInSeparateProcess
781-
*/
779+
#[RunInSeparateProcess]
782780
public function testInsulatedRequests()
783781
{
784782
$client = $this->getBrowser();

Tests/CookieJarTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\BrowserKit\Tests;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\BrowserKit\Cookie;
1617
use Symfony\Component\BrowserKit\CookieJar;
@@ -114,9 +115,7 @@ public function testUpdateFromSetCookieWithMultipleCookies()
114115
$this->assertEquals($timestamp, $phpCookie->getExpiresTime());
115116
}
116117

117-
/**
118-
* @dataProvider provideAllValuesValues
119-
*/
118+
#[DataProvider('provideAllValuesValues')]
120119
public function testAllValues($uri, $values)
121120
{
122121
$cookieJar = new CookieJar();

Tests/CookieTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\BrowserKit\Tests;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\BrowserKit\Cookie;
1617
use Symfony\Component\BrowserKit\Exception\InvalidArgumentException;
@@ -36,9 +37,7 @@ public function testToString()
3637
$this->assertEquals('foo=bar; expires=Thu, 01 Jan 1970 00:00:02 GMT; path=/; secure; httponly; samesite=lax', (string) $cookie);
3738
}
3839

39-
/**
40-
* @dataProvider getTestsForToFromString
41-
*/
40+
#[DataProvider('getTestsForToFromString')]
4241
public function testToFromString($cookie, $url = null)
4342
{
4443
$this->assertEquals($cookie, (string) Cookie::fromString($cookie, $url));
@@ -65,9 +64,7 @@ public function testFromStringIgnoreSecureFlag()
6564
$this->assertFalse(Cookie::fromString('foo=bar; secure', 'http://example.com/')->isSecure());
6665
}
6766

68-
/**
69-
* @dataProvider getExpireCookieStrings
70-
*/
67+
#[DataProvider('getExpireCookieStrings')]
7168
public function testFromStringAcceptsSeveralExpiresDateFormats($cookie)
7269
{
7370
$this->assertEquals(1596185377, Cookie::fromString($cookie)->getExpiresTime());

Tests/HttpBrowserTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\BrowserKit\Tests;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use Symfony\Component\BrowserKit\CookieJar;
1516
use Symfony\Component\BrowserKit\History;
1617
use Symfony\Component\BrowserKit\HttpBrowser;
@@ -26,9 +27,7 @@ public function getBrowser(array $server = [], ?History $history = null, ?Cookie
2627
return new TestHttpClient($server, $history, $cookieJar);
2728
}
2829

29-
/**
30-
* @dataProvider validContentTypes
31-
*/
30+
#[DataProvider('validContentTypes')]
3231
public function testRequestHeaders(array $requestArguments, array $expectedArguments)
3332
{
3433
$client = $this->createMock(HttpClientInterface::class);
@@ -186,9 +185,7 @@ public function testMultiPartRequestWithAdditionalParametersOfTheSameName()
186185
]);
187186
}
188187

189-
/**
190-
* @dataProvider forwardSlashesRequestPathProvider
191-
*/
188+
#[DataProvider('forwardSlashesRequestPathProvider')]
192189
public function testMultipleForwardSlashesRequestPath(string $requestPath)
193190
{
194191
$client = $this->createMock(HttpClientInterface::class);

Tests/ResponseTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\BrowserKit\Tests;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\BrowserKit\Exception\JsonException;
1617
use Symfony\Component\BrowserKit\Response;
@@ -90,9 +91,7 @@ public function testToArray()
9091
], $response->toArray(), '->toArray returns an array representation of json content');
9192
}
9293

93-
/**
94-
* @dataProvider provideInvalidJson
95-
*/
94+
#[DataProvider('provideInvalidJson')]
9695
public function testToArrayThrowsErrorOnInvalidJson(string $data)
9796
{
9897
$response = new Response($data);

0 commit comments

Comments
 (0)