diff --git a/src/Command/AutoconfigureCommand.php b/src/Command/AutoconfigureCommand.php deleted file mode 100644 index 75b0a9c..0000000 --- a/src/Command/AutoconfigureCommand.php +++ /dev/null @@ -1,20 +0,0 @@ - "testProject", + "enabled" => true, + "pingCollector" => 'always_ok', + ]); + self::bootKernel(); + + $project = ProjectFactory::createOne([ + "code" => "testProject", + "enabled" => true, + ]); + $startDate = (new DateTimeImmutable("midnight"))->modify("-1minute"); + for ($i = 0; $i < $steps; $i++) { + RecordPingFactory::createMany($count, [ + 'date' => $startDate->modify("-" . ($i) . " minutes"), + "project" => $project, + "statusCode" => Response::HTTP_OK + ]); +// RecordPingFactory::createMany($count, [ +// 'date' => new \DateTimeImmutable("-".($i)." minutes"), +// "project" => $project, +// "statusCode" => Response::HTTP_INTERNAL_SERVER_ERROR +// ]); + } + + $application = new Application(self::$kernel); + $command = $application->find('app:record-optimizer'); + $commandTester = new CommandTester($command); + $commandTester->execute(array('command' => $command->getName(), "--past" => 0, "--precision" => $precision)); + $records = RecordPingFactory::findBy([ + "statusCode" => Response::HTTP_OK + ]); + $this->assertSame($targetCount, count($records)); + for ($pos = 0; $pos < $targetCount; $pos++) { + $date = new DateTimeImmutable("+" . ($pos * $precision) . "minutes"); + + } + } + + public function logsProvider(): iterable + { + yield [10, 35, 10, 4]; + yield [1, 40, 30, 2]; + } + +} \ No newline at end of file