Code Duplication    Length = 18-18 lines in 6 locations

tests/Date/IsTest.php 6 locations

@@ 157-174 (lines=18) @@
154
        $this->assertFalse(Date::now()->addMonth()->previous(Date::MONDAY)->isSunday());
155
    }
156
157
    public function testIsMonday()
158
    {
159
        // True in the past past
160
        $this->assertTrue(Date::createFromDate(2015, 6, 1)->isMonday());
161
        $this->assertTrue(Date::now()->subWeek()->previous(Date::MONDAY)->isMonday());
162
163
        // True in the future
164
        $this->assertTrue(Date::now()->addWeek()->previous(Date::MONDAY)->isMonday());
165
        $this->assertTrue(Date::now()->addMonth()->previous(Date::MONDAY)->isMonday());
166
167
        // False in the past
168
        $this->assertFalse(Date::now()->subWeek()->previous(Date::TUESDAY)->isMonday());
169
        $this->assertFalse(Date::now()->subMonth()->previous(Date::TUESDAY)->isMonday());
170
171
        // False in the future
172
        $this->assertFalse(Date::now()->addWeek()->previous(Date::TUESDAY)->isMonday());
173
        $this->assertFalse(Date::now()->addMonth()->previous(Date::TUESDAY)->isMonday());
174
    }
175
176
    public function testIsTuesday()
177
    {
@@ 176-193 (lines=18) @@
173
        $this->assertFalse(Date::now()->addMonth()->previous(Date::TUESDAY)->isMonday());
174
    }
175
176
    public function testIsTuesday()
177
    {
178
        // True in the past past
179
        $this->assertTrue(Date::createFromDate(2015, 6, 2)->isTuesday());
180
        $this->assertTrue(Date::now()->subWeek()->previous(Date::TUESDAY)->isTuesday());
181
182
        // True in the future
183
        $this->assertTrue(Date::now()->addWeek()->previous(Date::TUESDAY)->isTuesday());
184
        $this->assertTrue(Date::now()->addMonth()->previous(Date::TUESDAY)->isTuesday());
185
186
        // False in the past
187
        $this->assertFalse(Date::now()->subWeek()->previous(Date::WEDNESDAY)->isTuesday());
188
        $this->assertFalse(Date::now()->subMonth()->previous(Date::WEDNESDAY)->isTuesday());
189
190
        // False in the future
191
        $this->assertFalse(Date::now()->addWeek()->previous(Date::WEDNESDAY)->isTuesday());
192
        $this->assertFalse(Date::now()->addMonth()->previous(Date::WEDNESDAY)->isTuesday());
193
    }
194
195
    public function testIsWednesday()
196
    {
@@ 195-212 (lines=18) @@
192
        $this->assertFalse(Date::now()->addMonth()->previous(Date::WEDNESDAY)->isTuesday());
193
    }
194
195
    public function testIsWednesday()
196
    {
197
        // True in the past past
198
        $this->assertTrue(Date::createFromDate(2015, 6, 3)->isWednesday());
199
        $this->assertTrue(Date::now()->subWeek()->previous(Date::WEDNESDAY)->isWednesday());
200
201
        // True in the future
202
        $this->assertTrue(Date::now()->addWeek()->previous(Date::WEDNESDAY)->isWednesday());
203
        $this->assertTrue(Date::now()->addMonth()->previous(Date::WEDNESDAY)->isWednesday());
204
205
        // False in the past
206
        $this->assertFalse(Date::now()->subWeek()->previous(Date::THURSDAY)->isWednesday());
207
        $this->assertFalse(Date::now()->subMonth()->previous(Date::THURSDAY)->isWednesday());
208
209
        // False in the future
210
        $this->assertFalse(Date::now()->addWeek()->previous(Date::THURSDAY)->isWednesday());
211
        $this->assertFalse(Date::now()->addMonth()->previous(Date::THURSDAY)->isWednesday());
212
    }
213
214
    public function testIsThursday()
215
    {
@@ 214-231 (lines=18) @@
211
        $this->assertFalse(Date::now()->addMonth()->previous(Date::THURSDAY)->isWednesday());
212
    }
213
214
    public function testIsThursday()
215
    {
216
        // True in the past past
217
        $this->assertTrue(Date::createFromDate(2015, 6, 4)->isThursday());
218
        $this->assertTrue(Date::now()->subWeek()->previous(Date::THURSDAY)->isThursday());
219
220
        // True in the future
221
        $this->assertTrue(Date::now()->addWeek()->previous(Date::THURSDAY)->isThursday());
222
        $this->assertTrue(Date::now()->addMonth()->previous(Date::THURSDAY)->isThursday());
223
224
        // False in the past
225
        $this->assertFalse(Date::now()->subWeek()->previous(Date::FRIDAY)->isThursday());
226
        $this->assertFalse(Date::now()->subMonth()->previous(Date::FRIDAY)->isThursday());
227
228
        // False in the future
229
        $this->assertFalse(Date::now()->addWeek()->previous(Date::FRIDAY)->isThursday());
230
        $this->assertFalse(Date::now()->addMonth()->previous(Date::FRIDAY)->isThursday());
231
    }
232
233
    public function testIsFriday()
234
    {
@@ 233-250 (lines=18) @@
230
        $this->assertFalse(Date::now()->addMonth()->previous(Date::FRIDAY)->isThursday());
231
    }
232
233
    public function testIsFriday()
234
    {
235
        // True in the past past
236
        $this->assertTrue(Date::createFromDate(2015, 6, 5)->isFriday());
237
        $this->assertTrue(Date::now()->subWeek()->previous(Date::FRIDAY)->isFriday());
238
239
        // True in the future
240
        $this->assertTrue(Date::now()->addWeek()->previous(Date::FRIDAY)->isFriday());
241
        $this->assertTrue(Date::now()->addMonth()->previous(Date::FRIDAY)->isFriday());
242
243
        // False in the past
244
        $this->assertFalse(Date::now()->subWeek()->previous(Date::SATURDAY)->isFriday());
245
        $this->assertFalse(Date::now()->subMonth()->previous(Date::SATURDAY)->isFriday());
246
247
        // False in the future
248
        $this->assertFalse(Date::now()->addWeek()->previous(Date::SATURDAY)->isFriday());
249
        $this->assertFalse(Date::now()->addMonth()->previous(Date::SATURDAY)->isFriday());
250
    }
251
252
    public function testIsSaturday()
253
    {
@@ 252-269 (lines=18) @@
249
        $this->assertFalse(Date::now()->addMonth()->previous(Date::SATURDAY)->isFriday());
250
    }
251
252
    public function testIsSaturday()
253
    {
254
        // True in the past past
255
        $this->assertTrue(Date::createFromDate(2015, 6, 6)->isSaturday());
256
        $this->assertTrue(Date::now()->subWeek()->previous(Date::SATURDAY)->isSaturday());
257
258
        // True in the future
259
        $this->assertTrue(Date::now()->addWeek()->previous(Date::SATURDAY)->isSaturday());
260
        $this->assertTrue(Date::now()->addMonth()->previous(Date::SATURDAY)->isSaturday());
261
262
        // False in the past
263
        $this->assertFalse(Date::now()->subWeek()->previous(Date::SUNDAY)->isSaturday());
264
        $this->assertFalse(Date::now()->subMonth()->previous(Date::SUNDAY)->isSaturday());
265
266
        // False in the future
267
        $this->assertFalse(Date::now()->addWeek()->previous(Date::SUNDAY)->isSaturday());
268
        $this->assertFalse(Date::now()->addMonth()->previous(Date::SUNDAY)->isSaturday());
269
    }
270
}
271