Skip to content

Commit 7e62726

Browse files
YAGNI tests
1 parent bf9b2c7 commit 7e62726

File tree

3 files changed

+0
-75
lines changed

3 files changed

+0
-75
lines changed

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/DateRangeTest.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -243,24 +243,6 @@ public function throws_exception_for_invalid_upper_bound(): void
243243
new DateRange(new \DateTimeImmutable('2023-01-01'), 'invalid');
244244
}
245245

246-
#[Test]
247-
public function throws_exception_for_invalid_lower_bound_type(): void
248-
{
249-
$this->expectException(\InvalidArgumentException::class);
250-
$this->expectExceptionMessage('Lower bound must be DateTimeInterface');
251-
252-
new DateRange('invalid', new \DateTimeImmutable('2023-12-31'));
253-
}
254-
255-
#[Test]
256-
public function throws_exception_for_invalid_upper_bound_type(): void
257-
{
258-
$this->expectException(\InvalidArgumentException::class);
259-
$this->expectExceptionMessage('Upper bound must be DateTimeInterface');
260-
261-
new DateRange(new \DateTimeImmutable('2023-01-01'), 'invalid');
262-
}
263-
264246
#[Test]
265247
public function throws_exception_for_invalid_datetime_in_comparison_via_contains(): void
266248
{
@@ -275,15 +257,6 @@ public function throws_exception_for_invalid_datetime_in_comparison_via_contains
275257
$dateRange->contains('invalid');
276258
}
277259

278-
#[Test]
279-
public function throws_exception_for_invalid_value_in_constructor(): void
280-
{
281-
$this->expectException(\InvalidArgumentException::class);
282-
$this->expectExceptionMessage('Lower bound must be DateTimeInterface');
283-
284-
new DateRange('invalid', new \DateTimeImmutable('2023-12-31'));
285-
}
286-
287260
#[Test]
288261
public function throws_exception_for_invalid_date_string_in_parse_via_from_string(): void
289262
{

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/NumericRangeTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,6 @@ public function throws_exception_for_invalid_numeric_bound_in_comparison_via_con
137137
$numericRange->contains('invalid');
138138
}
139139

140-
#[Test]
141-
public function throws_exception_for_invalid_value_in_constructor(): void
142-
{
143-
$this->expectException(\InvalidArgumentException::class);
144-
$this->expectExceptionMessage('Lower bound must be numeric');
145-
146-
new NumericRange('invalid', 10);
147-
}
148-
149140
#[Test]
150141
public function throws_exception_for_invalid_parse_value_via_from_string(): void
151142
{

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/ValueObject/TstzRangeTest.php

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -175,45 +175,6 @@ public function handles_microseconds_with_timezone(): void
175175
self::assertEquals('[2023-01-01 10:00:00.123456+00:00,2023-01-01 18:00:00.654321+00:00)', (string) $tstzRange);
176176
}
177177

178-
public static function providesContainsTestCases(): \Generator
179-
{
180-
$tstzRange = new TstzRange(
181-
new \DateTimeImmutable('2023-01-01 10:00:00+00:00'),
182-
new \DateTimeImmutable('2023-01-01 18:00:00+00:00')
183-
);
184-
185-
yield 'contains timestamp in range' => [$tstzRange, new \DateTimeImmutable('2023-01-01 14:00:00+00:00'), true];
186-
yield 'contains lower bound (inclusive)' => [$tstzRange, new \DateTimeImmutable('2023-01-01 10:00:00+00:00'), true];
187-
yield 'does not contain upper bound (exclusive)' => [$tstzRange, new \DateTimeImmutable('2023-01-01 18:00:00+00:00'), false];
188-
yield 'does not contain timestamp before range' => [$tstzRange, new \DateTimeImmutable('2023-01-01 09:00:00+00:00'), false];
189-
yield 'does not contain timestamp after range' => [$tstzRange, new \DateTimeImmutable('2023-01-01 19:00:00+00:00'), false];
190-
yield 'does not contain null' => [$tstzRange, null, false];
191-
192-
$emptyRange = TstzRange::empty();
193-
yield 'empty range contains nothing' => [$emptyRange, new \DateTimeImmutable('2023-01-01 14:00:00+00:00'), false];
194-
}
195-
196-
public static function providesFromStringTestCases(): \Generator
197-
{
198-
yield 'simple range with timezone' => [
199-
'[2023-01-01 10:00:00+00:00,2023-01-01 18:00:00+00:00)',
200-
new TstzRange(new \DateTimeImmutable('2023-01-01 10:00:00+00:00'), new \DateTimeImmutable('2023-01-01 18:00:00+00:00')),
201-
];
202-
yield 'inclusive range with timezone' => [
203-
'[2023-01-01 10:00:00+02:00,2023-01-01 18:00:00+02:00]',
204-
new TstzRange(new \DateTimeImmutable('2023-01-01 10:00:00+02:00'), new \DateTimeImmutable('2023-01-01 18:00:00+02:00'), true, true),
205-
];
206-
yield 'infinite lower' => [
207-
'[,2023-01-01 18:00:00+00:00)',
208-
new TstzRange(null, new \DateTimeImmutable('2023-01-01 18:00:00+00:00')),
209-
];
210-
yield 'infinite upper' => [
211-
'[2023-01-01 10:00:00+00:00,)',
212-
new TstzRange(new \DateTimeImmutable('2023-01-01 10:00:00+00:00'), null),
213-
];
214-
yield 'empty range' => ['empty', TstzRange::empty()];
215-
}
216-
217178
#[Test]
218179
public function throws_exception_for_invalid_constructor_input(): void
219180
{

0 commit comments

Comments
 (0)