Skip to content

Commit 70fdb8f

Browse files
committed
fix: use correct path to pdodb binary in benchmark command tests
- Replace hardcoded vendor/bin/pdodb with realpath(__DIR__ . '/../../bin/pdodb') - Use same approach as other CLI tests (TableCommandCliTests, GenerateCommandCliTests) - Add assertion to verify binary exists before running commands - Fixes 'Could not open input file' errors in GitHub Actions
1 parent 29b2006 commit 70fdb8f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/shared/ApplicationAndCliCommandsTests.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ public function testBenchmarkQueryCommand(): void
422422
public function testBenchmarkQueryCommandWithError(): void
423423
{
424424
// Run in separate process to avoid exit() terminating PHPUnit
425-
$cmd = 'cd ' . escapeshellarg(getcwd()) . ' && php vendor/bin/pdodb benchmark query 2>&1';
425+
$bin = realpath(__DIR__ . '/../../bin/pdodb');
426+
$this->assertNotFalse($bin, 'pdodb binary should exist');
427+
$cmd = 'cd ' . escapeshellarg(getcwd()) . ' && php ' . escapeshellarg($bin) . ' benchmark query 2>&1';
426428
$output = shell_exec($cmd);
427429

428430
// Check if command executed and returned output
@@ -440,7 +442,9 @@ public function testBenchmarkQueryCommandWithError(): void
440442
public function testBenchmarkCrudCommand(): void
441443
{
442444
// Run in separate process to avoid exit() terminating PHPUnit
443-
$cmd = 'cd ' . escapeshellarg(getcwd()) . ' && php vendor/bin/pdodb benchmark crud non_existent_table 2>&1';
445+
$bin = realpath(__DIR__ . '/../../bin/pdodb');
446+
$this->assertNotFalse($bin, 'pdodb binary should exist');
447+
$cmd = 'cd ' . escapeshellarg(getcwd()) . ' && php ' . escapeshellarg($bin) . ' benchmark crud non_existent_table 2>&1';
444448
$output = shell_exec($cmd);
445449

446450
// Check if command executed and returned output
@@ -459,7 +463,9 @@ public function testBenchmarkCrudCommand(): void
459463
public function testBenchmarkCrudCommandWithNonExistentTable(): void
460464
{
461465
// Run in separate process to avoid exit() terminating PHPUnit
462-
$cmd = 'cd ' . escapeshellarg(getcwd()) . ' && php vendor/bin/pdodb benchmark crud non_existent_table 2>&1';
466+
$bin = realpath(__DIR__ . '/../../bin/pdodb');
467+
$this->assertNotFalse($bin, 'pdodb binary should exist');
468+
$cmd = 'cd ' . escapeshellarg(getcwd()) . ' && php ' . escapeshellarg($bin) . ' benchmark crud non_existent_table 2>&1';
463469
$output = shell_exec($cmd);
464470

465471
// Check if command executed and returned output
@@ -518,7 +524,9 @@ public function testBenchmarkProfileCommand(): void
518524
public function testBenchmarkProfileCommandWithoutQuery(): void
519525
{
520526
// Run in separate process to avoid exit() terminating PHPUnit
521-
$cmd = 'cd ' . escapeshellarg(getcwd()) . ' && php vendor/bin/pdodb benchmark profile 2>&1';
527+
$bin = realpath(__DIR__ . '/../../bin/pdodb');
528+
$this->assertNotFalse($bin, 'pdodb binary should exist');
529+
$cmd = 'cd ' . escapeshellarg(getcwd()) . ' && php ' . escapeshellarg($bin) . ' benchmark profile 2>&1';
522530
$output = shell_exec($cmd);
523531

524532
// Check if command executed and returned output

0 commit comments

Comments
 (0)