From f8ac0f14f07936f72cc1a442215ef6cb2d86dcf1 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Tue, 29 Apr 2025 22:25:32 -0400 Subject: [PATCH] Abstracts --- app/tests/integration/AbstractIntegration.php | 15 +++++++++++++++ app/tests/integration/HomeTest.php | 11 ++--------- app/tests/performance/AbstractPerformance.php | 17 +++++++++++++++++ app/tests/performance/HomeTest.php | 11 ++++++----- 4 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 app/tests/integration/AbstractIntegration.php create mode 100644 app/tests/performance/AbstractPerformance.php diff --git a/app/tests/integration/AbstractIntegration.php b/app/tests/integration/AbstractIntegration.php new file mode 100644 index 0000000..b33a4c6 --- /dev/null +++ b/app/tests/integration/AbstractIntegration.php @@ -0,0 +1,15 @@ +client = new Client(['base_uri' => $_ENV['APP_URL']]); + } +} \ No newline at end of file diff --git a/app/tests/integration/HomeTest.php b/app/tests/integration/HomeTest.php index fc5a6fd..946f0ce 100644 --- a/app/tests/integration/HomeTest.php +++ b/app/tests/integration/HomeTest.php @@ -1,17 +1,10 @@ client = new Client(['base_uri' => $_ENV['APP_URL']]); - } - public function testLoad(): void { $response = $this->client->get('/'); diff --git a/app/tests/performance/AbstractPerformance.php b/app/tests/performance/AbstractPerformance.php new file mode 100644 index 0000000..937575e --- /dev/null +++ b/app/tests/performance/AbstractPerformance.php @@ -0,0 +1,17 @@ +startTime = microtime(true); + } + protected function end(): float + { + return microtime(true) - $this->startTime; + } +} \ No newline at end of file diff --git a/app/tests/performance/HomeTest.php b/app/tests/performance/HomeTest.php index 820c2a7..92b699f 100644 --- a/app/tests/performance/HomeTest.php +++ b/app/tests/performance/HomeTest.php @@ -1,10 +1,11 @@ start(); $this->client->get('/'); - $end = microtime(true); - $this->assertLessThanOrEqual(1000, $end - $start); + $time = $this->end(); + $this->assertLessThanOrEqual(1000, $time); } }