1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Wed, 19 Feb 2025 03:53:54 +0100
Subject: Modernize PHPUnit syntax
---
test/EventManagerTest.php | 2 +-
test/LazyListenerAggregateTest.php | 2 +-
test/Test/EventListenerIntrospectionTraitTest.php | 3 +++
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/EventManagerTest.php b/test/EventManagerTest.php
index e70da79..c8f7ff7 100644
--- a/test/EventManagerTest.php
+++ b/test/EventManagerTest.php
@@ -58,7 +58,7 @@ final class EventManagerTest extends TestCase
$value = $r->getValue($manager);
self::assertIsArray($value);
$keys = array_keys($value);
- self::assertContainsOnly('string', $keys);
+ self::assertContainsOnlyString($keys);
/** @psalm-var list<string> */
return $keys;
diff --git a/test/LazyListenerAggregateTest.php b/test/LazyListenerAggregateTest.php
index b116fe2..402f222 100644
--- a/test/LazyListenerAggregateTest.php
+++ b/test/LazyListenerAggregateTest.php
@@ -182,7 +182,7 @@ final class LazyListenerAggregateTest extends TestCase
$events = $this->createMock(EventManagerInterface::class);
$events->expects(self::once())
->method('attach')
- ->with('event', self::isType('callable'), 1)
+ ->with('event', self::isCallable(), 1)
->willReturnArgument(1);
$listeners = [
diff --git a/test/Test/EventListenerIntrospectionTraitTest.php b/test/Test/EventListenerIntrospectionTraitTest.php
index 5c37fa2..32bb253 100644
--- a/test/Test/EventListenerIntrospectionTraitTest.php
+++ b/test/Test/EventListenerIntrospectionTraitTest.php
@@ -6,6 +6,7 @@ namespace LaminasTest\EventManager\Test;
use Laminas\EventManager\EventManager;
use Laminas\EventManager\Test\EventListenerIntrospectionTrait;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
use Traversable;
@@ -35,6 +36,7 @@ final class EventListenerIntrospectionTraitTest extends TestCase
self::assertEquals(['foo', 'bar', 'baz'], $this->getEventsFromEventManager($this->events));
}
+ #[RequiresPhpunit('<12')]
public function testGetListenersForEventReturnsIteratorOfListenersForEventInPriorityOrder(): void
{
// @codingStandardsIgnoreStart
@@ -122,6 +124,7 @@ final class EventListenerIntrospectionTraitTest extends TestCase
], $listeners);
}
+ #[RequiresPhpunit('<12')]
public function testGetArrayOfListenersForEventReturnsArrayOfListenersInPriorityOrder(): void
{
// @codingStandardsIgnoreStart
|