-
-
Notifications
You must be signed in to change notification settings - Fork 152
Expand file tree
/
Copy pathSwiftSchedulingTest.php
More file actions
252 lines (215 loc) · 9.86 KB
/
Copy pathSwiftSchedulingTest.php
File metadata and controls
252 lines (215 loc) · 9.86 KB
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?php
declare(strict_types=1);
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\TestCase;
class SwiftSchedulingTest extends TestCase
{
public static function setUpBeforeClass(): void
{
require_once 'SwiftScheduling.php';
}
/**
* uuid: 1d0e6e72-f370-408c-bc64-5dafa9c6da73
*/
#[TestDox('NOW translates to two hours later')]
public function testNowTranslatesToTwoHoursLater(): void
{
$description = "NOW";
$meetingStart = new DateTime("2012-02-13T09:00:00");
$expected = new DateTime("2012-02-13T11:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 93325e7b-677d-4d96-b017-2582af879dc2
*/
#[TestDox('ASAP before one in the afternoon translates to today at five in the afternoon')]
public function testAsapBeforeOneInTheAfternoonTranslatesToTodayAtFiveInTheAfternoon(): void
{
$description = "ASAP";
$meetingStart = new DateTime("1999-06-03T09:45:00");
$expected = new DateTime("1999-06-03T17:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: cb4252a3-c4c1-41f6-8b8c-e7269733cef8
*/
#[TestDox('ASAP at one in the afternoon translates to tomorrow at one in the afternoon')]
public function testAsapAtOneInTheAfternoonTranslatesToTomorrowAtOneInTheAfternoon(): void
{
$description = "ASAP";
$meetingStart = new DateTime("2008-12-21T13:00:00");
$expected = new DateTime("2008-12-22T13:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 6fddc1ea-2fe9-4c60-81f7-9220d2f45537
*/
#[TestDox('ASAP after one in the afternoon translates to tomorrow at one in the afternoon')]
public function testAsapAfterOneInTheAfternoonTranslatesToTomorrowAtOneInTheAfternoon(): void
{
$description = "ASAP";
$meetingStart = new DateTime("2008-12-21T14:50:00");
$expected = new DateTime("2008-12-22T13:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 25f46bf9-6d2a-4e95-8edd-f62dd6bc8a6e
*/
#[TestDox('EOW on Monday translates to Friday at five in the afternoon')]
public function testEowOnMondayTranslatesToFridayAtFiveInTheAfternoon(): void
{
$description = "EOW";
$meetingStart = new DateTime("2025-02-03T16:00:00");
$expected = new DateTime("2025-02-07T17:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 0b375df5-d198-489e-acee-fd538a768616
*/
#[TestDox('EOW on Tuesday translates to Friday at five in the afternoon')]
public function testEowOnTuesdayTranslatesToFridayAtFiveInTheAfternoon(): void
{
$description = "EOW";
$meetingStart = new DateTime("1997-04-29T10:50:00");
$expected = new DateTime("1997-05-02T17:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 4afbb881-0b5c-46be-94e1-992cdc2a8ca4
*/
#[TestDox('EOW on Wednesday translates to Friday at five in the afternoon')]
public function testEowOnWednesdayTranslatesToFridayAtFiveInTheAfternoon(): void
{
$description = "EOW";
$meetingStart = new DateTime("2005-09-14T11:00:00");
$expected = new DateTime("2005-09-16T17:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: e1341c2b-5e1b-4702-a95c-a01e8e96e510
*/
#[TestDox('EOW on Thursday translates to Sunday at eight in the evening')]
public function testEowOnThursdayTranslatesToSundayAtEightInTheEvening(): void
{
$description = "EOW";
$meetingStart = new DateTime("2011-05-19T08:30:00");
$expected = new DateTime("2011-05-22T20:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: bbffccf7-97f7-4244-888d-bdd64348fa2e
*/
#[TestDox('EOW on Friday translates to Sunday at eight in the evening')]
public function testEowOnFridayTranslatesToSundayAtEightInTheEvening(): void
{
$description = "EOW";
$meetingStart = new DateTime("2022-08-05T14:00:00");
$expected = new DateTime("2022-08-07T20:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: d651fcf4-290e-407c-8107-36b9076f39b2
*/
#[TestDox('EOW translates to leap day')]
public function testEowTranslatesToLeapDay(): void
{
$description = "EOW";
$meetingStart = new DateTime("2008-02-25T10:30:00");
$expected = new DateTime("2008-02-29T17:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 439bf09f-3a0e-44e7-bad5-b7b6d0c4505a
*/
#[TestDox('2M before the second month of this year translates to the first workday of the second month of this year')]
public function testTwoMBeforeTheSecondMonthOfThisYearTranslatesToTheFirstWorkdayOfTheSecondMonthOfThisYear(): void
{
$description = "2M";
$meetingStart = new DateTime("2007-01-02T14:15:00");
$expected = new DateTime("2007-02-01T08:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 86d82e83-c481-4fb4-9264-625de7521340
*/
#[TestDox('11M in the eleventh month translates to the first workday of the eleventh month of next year')]
public function testElevenMInTheEleventhMonthTranslatesToTheFirstWorkdayOfTheEleventhMonthOfNextYear(): void
{
$description = "11M";
$meetingStart = new DateTime("2013-11-21T15:30:00");
$expected = new DateTime("2014-11-03T08:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 0d0b8f6a-1915-46f5-a630-1ff06af9da08
*/
#[TestDox('4M in the ninth month translates to the first workday of the fourth month of next year')]
public function testFourMInTheNinthMonthTranslatesToTheFirstWorkdayOfTheFourthMonthOfNextYear(): void
{
$description = "4M";
$meetingStart = new DateTime("2019-11-18T15:15:00");
$expected = new DateTime("2020-04-01T08:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 06d401e3-8461-438f-afae-8d26aa0289e0
*/
#[TestDox('Q1 in the first quarter translates to the last workday of the first quarter of this year')]
public function testQOneInTheFirstQuarterTranslatesToTheLastWorkdayOfTheFirstQuarterOfThisYear(): void
{
$description = "Q1";
$meetingStart = new DateTime("2003-01-01T10:45:00");
$expected = new DateTime("2003-03-31T08:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: eebd5f32-b16d-4ecd-91a0-584b0364b7ed
*/
#[TestDox('Q4 in the second quarter translates to the last workday of the fourth quarter of this year')]
public function testQFourInTheSecondQuarterTranslatesToTheLastWorkdayOfTheFourthQuarterOfThisYear(): void
{
$description = "Q4";
$meetingStart = new DateTime("2001-04-09T09:00:00");
$expected = new DateTime("2001-12-31T08:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: c920886c-44ad-4d34-a156-dc4176186581
*/
#[TestDox('Q3 in the fourth quarter translates to the last workday of the third quarter of next year')]
public function testQThreeInTheFourthQuarterTranslatesToTheLastWorkdayOfTheThirdQuarterOfNextYear(): void
{
$description = "Q3";
$meetingStart = new DateTime("2022-10-06T11:00:00");
$expected = new DateTime("2023-09-29T08:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
/**
* uuid: 7c8f1616-be62-417e-bbd5-a60fa743eccc
*/
#[TestDox('Q2 starting in the last month of the second quarter translates to the last workday of the second quarter of this year')]
public function testQTwoStartingInTheLastMonthOfTheSecondQuarterTranslatesToTheLastWorkdayOfTheSecondQuarterOfThisYear(): void
{
$description = "Q2";
$meetingStart = new DateTime("2019-06-15T09:50:00");
$expected = new DateTime("2019-06-28T08:00:00");
$swiftScheduling = new SwiftScheduling($meetingStart);
$this->assertEquals($expected, $swiftScheduling->deliveryDate($description));
}
}