chore: implement php test suites
PHP Integration Tests / Integration Tests (pull_request) Failing after 1m5s
PHP Unit Tests / test (pull_request) Successful in 2m10s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-07-23 22:20:36 -04:00
parent a3e06a2da9
commit 18e18be2b2
9 changed files with 1778 additions and 17 deletions
@@ -60,7 +60,7 @@ abstract class IntegrationTestCase extends TestCase
protected static function buildServer(): Server
{
return new Server(KTRIX_SERVER_ROOT);
return new Server(SERVER_ROOT);
}
// =========================================================================
@@ -127,7 +127,7 @@ abstract class IntegrationTestCase extends TestCase
*/
protected static function runConsole(array $args): string
{
$command = escapeshellcmd(PHP_BINARY) . ' ' . escapeshellarg(KTRIX_SERVER_ROOT . '/bin/console');
$command = escapeshellcmd(PHP_BINARY) . ' ' . escapeshellarg(SERVER_ROOT . '/bin/console');
foreach ($args as $arg) {
$command .= ' ' . escapeshellarg((string) $arg);
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace KTXT\AuthenticationProviderPassword\Tests\Unit;
use PHPUnit\Framework\TestCase;
class BaseTest extends TestCase
{
public function testBasicAssertion(): void
{
$this->assertTrue(true);
}
public function testArrayOperations(): void
{
$array = ['foo' => 'bar'];
$this->assertArrayHasKey('foo', $array);
$this->assertEquals('bar', $array['foo']);
}
public function testStringOperations(): void
{
$string = 'Hello, World!';
$this->assertStringContainsString('World', $string);
$this->assertEquals(13, strlen($string));
}
}
+2 -2
View File
@@ -6,9 +6,9 @@ declare(strict_types=1);
// server's own vendor/autoload.php (core + shared + framework deps) is a
// fixed number of levels above this file. Every other test file resolves
// the server root through this constant rather than repeating the math.
define('KTRIX_SERVER_ROOT', dirname(__DIR__, 4));
define('SERVER_ROOT', dirname(__DIR__, 4));
require KTRIX_SERVER_ROOT . '/vendor/autoload.php';
require SERVER_ROOT . '/vendor/autoload.php';
require __DIR__ . '/Integration/IntegrationTestCase.php';
if (isset($_SERVER['APP_DEBUG']) && $_SERVER['APP_DEBUG']) {
@@ -2,7 +2,7 @@
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
failOnDeprecation="true"
failOnNotice="true"
@@ -17,8 +17,11 @@
</php>
<testsuites>
<testsuite name="Unit Tests">
<directory>Unit</directory>
</testsuite>
<testsuite name="Integration Tests">
<directory suffix="Test.php">Integration</directory>
<directory>Integration</directory>
</testsuite>
</testsuites>