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
|
From: Athos Ribeiro <athoscribeiro@gmail.com>
Date: Thu, 6 Jul 2023 16:28:53 -0300
Subject: Add support for phpunit 10
In phpunit 10, global states are no longer preserved by default [1].
Bugs-Debian: https://bugs.debian.org/1039746 https://bugs.debian.org/1099659
[1] https://github.com/sebastianbergmann/phpunit/blob/10.0.0/ChangeLog-10.0.md#changed
---
testing/phpunit/ExpansionTest.php | 10 ++++++++++
testing/phpunit/RangeTest.php | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/testing/phpunit/ExpansionTest.php b/testing/phpunit/ExpansionTest.php
index 5a71318..a6ab0b0 100644
--- a/testing/phpunit/ExpansionTest.php
+++ b/testing/phpunit/ExpansionTest.php
@@ -5,6 +5,8 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '/usr/share/awl/inc' . PA
require_once('RRule.php');
require_once('vCalendar.php');
+use PHPUnit\Framework\Attributes\PreserveGlobalState;
+use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\TestCase;
$c = (object) array();
@@ -143,6 +145,8 @@ final class ExpansionTest extends TestCase
'20190124T000000Z/20190124T010000Z',
];
+ #[PreserveGlobalState('enabled')]
+ #[RunInSeparateProcess]
public function testUnmodifiedCal() {
global $base_cal;
@@ -152,6 +156,8 @@ final class ExpansionTest extends TestCase
);
}
+ #[PreserveGlobalState('enabled')]
+ #[RunInSeparateProcess]
public function testTueRenamed() {
global $tuesday_renamed_cal;
@@ -161,6 +167,8 @@ final class ExpansionTest extends TestCase
);
}
+ #[PreserveGlobalState('enabled')]
+ #[RunInSeparateProcess]
public function testTueRenamedSwapped() {
global $tuesday_renamed_cal_order_swapped;
@@ -170,6 +178,8 @@ final class ExpansionTest extends TestCase
);
}
+ #[PreserveGlobalState('enabled')]
+ #[RunInSeparateProcess]
public function testCalWithCount() {
global $count_cal;
diff --git a/testing/phpunit/RangeTest.php b/testing/phpunit/RangeTest.php
index 5b865d5..99acb1a 100644
--- a/testing/phpunit/RangeTest.php
+++ b/testing/phpunit/RangeTest.php
@@ -5,6 +5,8 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '/usr/share/awl/inc' . PA
require_once('RRule.php');
require_once('vCalendar.php');
+use PHPUnit\Framework\Attributes\PreserveGlobalState;
+use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\TestCase;
$c = (object) array();
@@ -12,6 +14,8 @@ $c->rrule_loop_limit = 100;
final class RangeTest extends TestCase
{
+ #[PreserveGlobalState('enabled')]
+ #[RunInSeparateProcess]
public function testGetVCalendarRange() {
$cal = new vCalendar("BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
@@ -48,6 +52,8 @@ END:VCALENDAR");
self::assertEquals("20190102T072000Z", (string) $range->until->UTC());
}
+ #[PreserveGlobalState('enabled')]
+ #[RunInSeparateProcess]
public function testGetVCalendarRangeTwoDayAllDay() {
$cal = new vCalendar("BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
@@ -70,6 +76,8 @@ END:VCALENDAR");
self::assertEquals("20190109T200000Z", (string) $range->until->UTC());
}
+ #[PreserveGlobalState('enabled')]
+ #[RunInSeparateProcess]
public function testGetVCalendarRangeFloating() {
// When interpreted as being in Greece, this event crosses the daylight savings boundary!
// TODO deal with how that affects all-day events...
@@ -94,6 +102,8 @@ END:VCALENDAR");
self::assertEquals("20181210T130000Z", (string) $range->until->UTC());
}
+ #[PreserveGlobalState('enabled')]
+ #[RunInSeparateProcess]
public function testGetVCalendarRangeAllDayAcrossDST() {
// When interpreted as being in Greece, this event crosses the daylight savings boundary!
|