Skip to content

Commit 8ec9ef7

Browse files
committed
TEST: Added backwards compatibility so parameterised tests work before and after phpunit 10.
1 parent 611d814 commit 8ec9ef7

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

tests/EnableCookiesTests.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
use fiftyone\pipeline\core\SequenceElement;
3232
use fiftyone\pipeline\core\JsonBundlerElement;
3333
use PHPUnit\Framework\TestCase;
34-
use PHPUnit\Framework\Attributes\TestWith;
34+
use PHPUnit\Framework\Attributes\DataProvider;
3535

3636
class CookieElement extends FlowElement
3737
{
@@ -58,13 +58,21 @@ public function processInternal($flowData): void
5858

5959
class EnableCookiesTests extends TestCase
6060
{
61+
public static function provider_testJavaScriptCookies()
62+
{
63+
return [
64+
[false, false, false],
65+
[true, false, false],
66+
[false, true, true],
67+
[true, true, true]
68+
];
69+
}
70+
6171
/**
6272
* Test that the cookie settings are respected correctly.
73+
* @dataProvider provider_testJavaScriptCookies
6374
*/
64-
#[TestWith([false, false, false])]
65-
#[TestWith([true, false, false])]
66-
#[TestWith([false, true, true])]
67-
#[TestWith([true, true, true])]
75+
#[DataProvider("provider_testJavaScriptCookies")]
6876
public function testJavaScriptCookies($enableInConfig, $enableInEvidence, $expectCookie)
6977
{
7078
$jsElement = new JavascriptBuilderElement([
@@ -84,7 +92,7 @@ public function testJavaScriptCookies($enableInConfig, $enableInEvidence, $expec
8492

8593
$js = $flowData->javascriptbuilder->javascript;
8694
$matches = substr_count($js, 'document.cookie');
87-
if ($expectCookie) {
95+
if ($expectCookie === true) {
8896
$this->assertSame(2, $matches);
8997
}
9098
else {

tests/SetHeaderTests.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public static function provider_testGetResponseHeaderValue()
8181

8282
/**
8383
* Test response header value to be set for UACH.
84+
*
85+
* @dataProvider provider_testGetResponseHeaderValue
8486
*/
8587
#[DataProvider("provider_testGetResponseHeaderValue")]
8688
public function testGetResponseHeaderValue($device, $expectedValue)
@@ -140,6 +142,7 @@ public static function provider_testGetResponseHeaderName_Valid()
140142

141143
/**
142144
* Test get response header function for valid formats.
145+
* @dataProvider provider_testGetResponseHeaderName_Valid
143146
*/
144147
#[DataProvider("provider_testGetResponseHeaderName_Valid")]
145148
public function testGetResponseHeaderNameValid($data, $expectedValue)
@@ -161,6 +164,7 @@ public static function provider_testGetResponseHeaderName_InValid()
161164

162165
/**
163166
* Test get response header function for valid formats.
167+
* @dataProvider provider_testGetResponseHeaderName_InValid
164168
*/
165169
#[DataProvider("provider_testGetResponseHeaderName_InValid")]
166170
public function testGetResponseHeaderNameInValid($data, $expectedValue)

0 commit comments

Comments
 (0)