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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
|
From: Joe Nahmias <jello@debian.org>
Date: Mon, 1 Sep 2025 22:03:29 -0400
Subject: switch to PHP attributes for PHPUnit 12
---
.../iCal/Component/CalendarIntegrationTest.php | 17 +++-----
tests/Eluceo/iCal/ParameterBagTest.php | 5 +--
tests/Eluceo/iCal/Property/ArrayValueTest.php | 9 ++---
.../iCal/Property/Event/RecurrenceRuleTest.php | 47 ++++------------------
4 files changed, 19 insertions(+), 59 deletions(-)
diff --git a/tests/Eluceo/iCal/Component/CalendarIntegrationTest.php b/tests/Eluceo/iCal/Component/CalendarIntegrationTest.php
index 1b4d55d..b6f0ff6 100644
--- a/tests/Eluceo/iCal/Component/CalendarIntegrationTest.php
+++ b/tests/Eluceo/iCal/Component/CalendarIntegrationTest.php
@@ -2,13 +2,14 @@
namespace Eluceo\iCal\Component;
+use PHPUnit\Framework\Attributes\CoversMethod;
+use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\TestCase;
+#[CoversMethod('Event', 'addAttachment')]
class CalendarIntegrationTest extends TestCase
{
- /**
- * @coversNothing
- */
+ #[CoversNothing]
public function testExample3()
{
$timeZone = new \DateTimeZone('Europe/Berlin');
@@ -65,9 +66,7 @@ class CalendarIntegrationTest extends TestCase
}
}
- /**
- * @coversNothing
- */
+ #[CoversNothing]
public function testExample4b()
{
$timeZoneString = '/example.com/1.0.0-0/Europe/Berlin';
@@ -124,9 +123,8 @@ class CalendarIntegrationTest extends TestCase
* This test was introduced because of a regression bug.
*
* @see https://github.com/markuspoerschke/iCal/issues/98
- *
- * @coversNothing
*/
+ #[CoversNothing]
public function testRenderIsIdempotent()
{
$vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com');
@@ -142,9 +140,6 @@ class CalendarIntegrationTest extends TestCase
$this->assertEquals($vCalendar->render(), $vCalendar->render());
}
- /**
- * @covers \Eluceo\iCal\Component\Event::addAttachment()
- */
public function testEventAddAttachment()
{
$timeZone = new \DateTimeZone('Europe/Berlin');
diff --git a/tests/Eluceo/iCal/ParameterBagTest.php b/tests/Eluceo/iCal/ParameterBagTest.php
index e7a9e62..b2eaf0d 100644
--- a/tests/Eluceo/iCal/ParameterBagTest.php
+++ b/tests/Eluceo/iCal/ParameterBagTest.php
@@ -2,13 +2,12 @@
namespace Eluceo\iCal;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class ParameterBagTest extends TestCase
{
- /**
- * @dataProvider escapedParamsDataProvider
- */
+ #[DataProvider('escapedParamsDataProvider')]
public function testParamEscaping($value, $expected)
{
$propertyObject = new ParameterBag;
diff --git a/tests/Eluceo/iCal/Property/ArrayValueTest.php b/tests/Eluceo/iCal/Property/ArrayValueTest.php
index e9d8130..ed3626f 100644
--- a/tests/Eluceo/iCal/Property/ArrayValueTest.php
+++ b/tests/Eluceo/iCal/Property/ArrayValueTest.php
@@ -2,13 +2,12 @@
namespace Eluceo\iCal\Property;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class ArrayValueTest extends TestCase
{
- /**
- * @dataProvider arrayValuesProvider
- */
+ #[DataProvider('arrayValuesProvider')]
public function testArrayValue($values, $expectedOutput)
{
$arrayValue = new ArrayValue($values);
@@ -26,9 +25,7 @@ class ArrayValueTest extends TestCase
);
}
- /**
- * @dataProvider arrayValuesProvider
- */
+ #[DataProvider('arrayValuesProvider')]
public function testSetValues($values, $expectedOutput)
{
$arrayValue = new ArrayValue([]);
diff --git a/tests/Eluceo/iCal/Property/Event/RecurrenceRuleTest.php b/tests/Eluceo/iCal/Property/Event/RecurrenceRuleTest.php
index a19783e..6674679 100644
--- a/tests/Eluceo/iCal/Property/Event/RecurrenceRuleTest.php
+++ b/tests/Eluceo/iCal/Property/Event/RecurrenceRuleTest.php
@@ -2,6 +2,7 @@
namespace Eluceo\iCal\Property\Event;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class RecurrenceRuleTest extends TestCase
@@ -60,10 +61,6 @@ class RecurrenceRuleTest extends TestCase
$this->assertSame('1997-12-24', $result->format('Y-m-d'));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage The Frequency invalid_freq_string is not supported.
- */
public function testSetFreqOnInvalidFreq()
{
$this->expectException(\InvalidArgumentException::class);
@@ -115,11 +112,7 @@ class RecurrenceRuleTest extends TestCase
];
}
- /**
- * @dataProvider invalidMonthProvider
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid value for BYMONTH
- */
+ #[DataProvider('invalidMonthProvider')]
public function testSetByMonthOnInvalidMonth($month)
{
$this->expectException(\InvalidArgumentException::class);
@@ -146,11 +139,7 @@ class RecurrenceRuleTest extends TestCase
];
}
- /**
- * @dataProvider invalidByWeekNoProvider
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid value for BYWEEKNO
- */
+ #[DataProvider('invalidByWeekNoProvider')]
public function testSetByWeekNoOnInvalidByWeekNo($byWeekNo)
{
$this->expectException(\InvalidArgumentException::class);
@@ -177,11 +166,7 @@ class RecurrenceRuleTest extends TestCase
];
}
- /**
- * @dataProvider invalidByYearDayProvider
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid value for BYYEARDAY
- */
+ #[DataProvider('invalidByYearDayProvider')]
public function testSetByYearDayOnInvalidByYeraDay($day)
{
$this->expectException(\InvalidArgumentException::class);
@@ -208,11 +193,7 @@ class RecurrenceRuleTest extends TestCase
];
}
- /**
- * @dataProvider invalidByMonthDayProvider
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid value for BYMONTHDAY
- */
+ #[DataProvider('invalidByMonthDayProvider')]
public function testSetByMonthDayOnInvalidByMonthDay($day)
{
$this->expectException(\InvalidArgumentException::class);
@@ -238,11 +219,7 @@ class RecurrenceRuleTest extends TestCase
];
}
- /**
- * @dataProvider invalidByHourProvider
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid value for BYHOUR
- */
+ #[DataProvider('invalidByHourProvider')]
public function testSetByHourOnInvalidByHour($value)
{
$this->expectException(\InvalidArgumentException::class);
@@ -268,11 +245,7 @@ class RecurrenceRuleTest extends TestCase
];
}
- /**
- * @dataProvider invalidByMinuteProvider
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid value for BYMINUTE
- */
+ #[DataProvider('invalidByMinuteProvider')]
public function testSetByMinuteOnInvalidByMinute($value)
{
$this->expectException(\InvalidArgumentException::class);
@@ -298,11 +271,7 @@ class RecurrenceRuleTest extends TestCase
];
}
- /**
- * @dataProvider invalidBySecondProvider
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid value for BYSECOND
- */
+ #[DataProvider('invalidBySecondProvider')]
public function testSetBySecondOnInvalidBySecond($value)
{
$this->expectException(\InvalidArgumentException::class);
|