|
14 | 14 | // Let's assume we have a simple collection of log files from different folders.
|
15 | 15 | // When we try and turn that flat collection into a LogFolderCollection, it
|
16 | 16 | // could automatically group the logs into folders!
|
| 17 | + $debugFolder = 'debug'; |
| 18 | + $infoFolder = 'info'; |
17 | 19 | $logFileCollection = new LogFileCollection([
|
18 |
| - $debugFile1 = new LogFile('debug1.log', $debugFolder = 'debug'), |
19 |
| - $infoFile1 = new LogFile('info1.log', $infoFolder = 'info'), |
20 |
| - $debugFile2 = new Logfile('debug2.log', $debugFolder), |
21 |
| - $infoFile2 = new LogFile('info2.log', $infoFolder), |
| 20 | + $debugFile1 = new LogFile($debugFolder.'/debug1.log'), |
| 21 | + $infoFile1 = new LogFile($infoFolder.'/info1.log'), |
| 22 | + $debugFile2 = new Logfile($debugFolder.'/debug2.log'), |
| 23 | + $infoFile2 = new LogFile($infoFolder.'/info2.log'), |
22 | 24 | ]);
|
23 | 25 |
|
24 | 26 | $folderCollection = LogFolderCollection::fromFiles($logFileCollection);
|
|
67 | 69 | });
|
68 | 70 |
|
69 | 71 | test('LogFolderCollection can sort its folders by earliest first, including its files', function () {
|
70 |
| - $firstFile = Mockery::mock(new LogFile('test.log', 'test.log')) |
| 72 | + $firstFile = Mockery::mock(new LogFile('test.log')) |
71 | 73 | ->allows(['earliestTimestamp' => now()->subDay()->timestamp]);
|
72 |
| - $secondFile = Mockery::mock(new LogFile('test2.log', 'test2.log')) |
| 74 | + $secondFile = Mockery::mock(new LogFile('test2.log')) |
73 | 75 | ->allows(['earliestTimestamp' => now()->subDays(2)->timestamp]);
|
74 | 76 |
|
75 | 77 | $dummyFolder = Mockery::mock(new LogFolder('folder2', []))
|
|
94 | 96 | });
|
95 | 97 |
|
96 | 98 | test('LogFolderCollection can sort its folders by latest first, including its files', function () {
|
97 |
| - $firstFile = Mockery::mock(new LogFile('test.log', 'test.log')) |
| 99 | + $firstFile = Mockery::mock(new LogFile('test.log')) |
98 | 100 | ->allows(['latestTimestamp' => now()->subDays(2)->timestamp]);
|
99 |
| - $secondFile = Mockery::mock(new LogFile('test2.log', 'test2.log')) |
| 101 | + $secondFile = Mockery::mock(new LogFile('test2.log')) |
100 | 102 | ->allows(['latestTimestamp' => now()->subDay()->timestamp]);
|
101 | 103 |
|
102 | 104 | $dummyFolder = Mockery::mock(new LogFolder('folder2', []))
|
|
0 commit comments