Skip to content

Commit e6da5ad

Browse files
committed
refactor: removed deprecated method
1 parent 1e16242 commit e6da5ad

File tree

2 files changed

+0
-59
lines changed

2 files changed

+0
-59
lines changed

phpmyfaq/src/phpMyFAQ/Date.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,6 @@ public static function createIsoDateFromUnixTimestamp(int|string $timestamp, str
7878
return date($format, (int) $timestamp);
7979
}
8080

81-
/**
82-
* Backwards compatibility: Returns tracking file date.
83-
* If $endOfDay is truthy (>0), returns the end-of-day timestamp, otherwise start-of-day.
84-
* Note: Prefer using getTrackingFileDateStart()/getTrackingFileDateEnd().
85-
*/
86-
public function getTrackingFileDate(string $file, int $endOfDay = 0): int
87-
{
88-
return $endOfDay > 0 ? $this->getTrackingFileDateEnd($file) : $this->getTrackingFileDateStart($file);
89-
}
90-
9181
/**
9282
* Returns the start-of-day timestamp of a tracking filename (trackingDDMMYYYY).
9383
*/

tests/phpMyFAQ/DateTest.php

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -63,55 +63,6 @@ public function testCreateIsoDateWithDifferentFormats(): void
6363
$this->assertStringContainsString('January', $longFormat);
6464
}
6565

66-
public function testGetTrackingFileDateValid(): void
67-
{
68-
$filename = 'tracking25122023.log'; // 16 characters
69-
$result = $this->dateInstance->getTrackingFileDate($filename);
70-
71-
$this->assertIsInt($result);
72-
$this->assertGreaterThan(0, $result);
73-
74-
// Test that it's the beginning of the day
75-
$expectedDate = gmmktime(0, 0, 0, 12, 25, 2023);
76-
$this->assertEquals($expectedDate, $result);
77-
}
78-
79-
public function testGetTrackingFileDateEndOfDay(): void
80-
{
81-
$filename = 'tracking25122023.log';
82-
$result = $this->dateInstance->getTrackingFileDate($filename, true);
83-
84-
$this->assertIsInt($result);
85-
$this->assertGreaterThan(0, $result);
86-
87-
// Test that it's the end of the day
88-
$expectedDate = gmmktime(23, 59, 59, 12, 25, 2023);
89-
$this->assertEquals($expectedDate, $result);
90-
}
91-
92-
public function testGetTrackingFileDateInvalidFilename(): void
93-
{
94-
$shortFilename = 'short.log'; // Less than 16 characters
95-
$result = $this->dateInstance->getTrackingFileDate($shortFilename);
96-
97-
$this->assertEquals(-1, $result);
98-
}
99-
100-
public function testGetTrackingFileDateWithDifferentFormats(): void
101-
{
102-
// Test various valid tracking file names
103-
$testFiles = [
104-
'tracking01012024.log', // New Year's Day 2024
105-
'tracking31122023.log', // New Year's Eve 2023
106-
'tracking29022024.log', // Leap year day 2024
107-
];
108-
109-
foreach ($testFiles as $filename) {
110-
$result = $this->dateInstance->getTrackingFileDate($filename);
111-
$this->assertGreaterThan(0, $result, "Failed for file: $filename");
112-
}
113-
}
114-
11566
public function testFormatWithValidDate(): void
11667
{
11768
$inputDate = '2023-12-25 14:30:00';

0 commit comments

Comments
 (0)