31
31
use fiftyone \pipeline \core \SequenceElement ;
32
32
use fiftyone \pipeline \core \JsonBundlerElement ;
33
33
use PHPUnit \Framework \TestCase ;
34
- use PHPUnit \Framework \Attributes \TestWith ;
34
+ use PHPUnit \Framework \Attributes \DataProvider ;
35
35
36
36
class CookieElement extends FlowElement
37
37
{
@@ -58,13 +58,21 @@ public function processInternal($flowData): void
58
58
59
59
class EnableCookiesTests extends TestCase
60
60
{
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
+
61
71
/**
62
72
* Test that the cookie settings are respected correctly.
73
+ * @dataProvider provider_testJavaScriptCookies
63
74
*/
64
- #[TestWith([false , false , false ])]
65
- #[TestWith([true , false , false ])]
66
- #[TestWith([false , true , true ])]
67
- #[TestWith([true , true , true ])]
75
+ #[DataProvider("provider_testJavaScriptCookies " )]
68
76
public function testJavaScriptCookies ($ enableInConfig , $ enableInEvidence , $ expectCookie )
69
77
{
70
78
$ jsElement = new JavascriptBuilderElement ([
@@ -84,7 +92,7 @@ public function testJavaScriptCookies($enableInConfig, $enableInEvidence, $expec
84
92
85
93
$ js = $ flowData ->javascriptbuilder ->javascript ;
86
94
$ matches = substr_count ($ js , 'document.cookie ' );
87
- if ($ expectCookie ) {
95
+ if ($ expectCookie === true ) {
88
96
$ this ->assertSame (2 , $ matches );
89
97
}
90
98
else {
0 commit comments