Skip to content

Commit 2a4ea96

Browse files
committed
Leverage DataProvider attribute because PHPUnit 12 does not support annotations anymore
1 parent 8461203 commit 2a4ea96

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/StubTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Codeception\Stub;
88
use Codeception\Stub\StubMarshaler;
9+
use PHPUnit\Framework\Attributes\DataProvider;
910
use PHPUnit\Framework\MockObject\MockObject;
1011
use PHPUnit\Framework\MockObject\NoMoreReturnValuesConfiguredException;
1112
use PHPUnit\Framework\TestCase;
@@ -231,6 +232,7 @@ public static function matcherAndFailMessageProvider(): array
231232
/**
232233
* @dataProvider matcherAndFailMessageProvider
233234
*/
235+
#[DataProvider('matcherAndFailMessageProvider')]
234236
public function testExpectedMethodIsCalledFail(StubMarshaler $stubMarshaler, string $failMessage)
235237
{
236238
$mock = Stub::makeEmptyExcept('DummyClass', 'call', ['targetMethod' => $stubMarshaler], $this);
@@ -282,6 +284,7 @@ public static function matcherProvider(): array
282284
/**
283285
* @dataProvider matcherProvider
284286
*/
287+
#[DataProvider('matcherProvider')]
285288
public function testMethodMatcherWithMake(int $count, StubMarshaler $matcher, $expected = false)
286289
{
287290
$dummy = Stub::make('DummyClass', ['goodByeWorld' => $matcher], $this);
@@ -292,6 +295,7 @@ public function testMethodMatcherWithMake(int $count, StubMarshaler $matcher, $e
292295
/**
293296
* @dataProvider matcherProvider
294297
*/
298+
#[DataProvider('matcherProvider')]
295299
public function testMethodMatcherWithMakeEmpty(int $count, StubMarshaler $matcher)
296300
{
297301
$dummy = Stub::makeEmpty('DummyClass', ['goodByeWorld' => $matcher], $this);
@@ -302,6 +306,7 @@ public function testMethodMatcherWithMakeEmpty(int $count, StubMarshaler $matche
302306
/**
303307
* @dataProvider matcherProvider
304308
*/
309+
#[DataProvider('matcherProvider')]
305310
public function testMethodMatcherWithMakeEmptyExcept(int $count, StubMarshaler $matcher)
306311
{
307312
$dummy = Stub::makeEmptyExcept('DummyClass', 'getCheckMe', ['goodByeWorld' => $matcher], $this);
@@ -312,6 +317,7 @@ public function testMethodMatcherWithMakeEmptyExcept(int $count, StubMarshaler $
312317
/**
313318
* @dataProvider matcherProvider
314319
*/
320+
#[DataProvider('matcherProvider')]
315321
public function testMethodMatcherWithConstruct(int $count, StubMarshaler $matcher)
316322
{
317323
$dummy = Stub::construct('DummyClass', [], ['goodByeWorld' => $matcher], $this);
@@ -322,6 +328,7 @@ public function testMethodMatcherWithConstruct(int $count, StubMarshaler $matche
322328
/**
323329
* @dataProvider matcherProvider
324330
*/
331+
#[DataProvider('matcherProvider')]
325332
public function testMethodMatcherWithConstructEmpty(int $count, StubMarshaler $matcher)
326333
{
327334
$dummy = Stub::constructEmpty('DummyClass', [], ['goodByeWorld' => $matcher], $this);
@@ -332,6 +339,7 @@ public function testMethodMatcherWithConstructEmpty(int $count, StubMarshaler $m
332339
/**
333340
* @dataProvider matcherProvider
334341
*/
342+
#[DataProvider('matcherProvider')]
335343
public function testMethodMatcherWithConstructEmptyExcept(int $count, StubMarshaler $matcher)
336344
{
337345
$dummy = Stub::constructEmptyExcept(

0 commit comments

Comments
 (0)