chore: implement php test suites
JS Unit Tests / test (pull_request) Failing after 43s
Build Test / build (pull_request) Successful in 44s
PHP Unit Tests / test (pull_request) Successful in 1m9s
PHP Integration Tests / Integration Tests (pull_request) Successful in 1m28s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-07-23 22:20:35 -04:00
parent e81b848a02
commit b570150258
11 changed files with 337 additions and 340 deletions
@@ -0,0 +1,50 @@
name: PHP Integration Tests
on:
pull_request:
workflow_dispatch:
jobs:
test:
name: Integration Tests
runs-on: ubuntu-latest
services:
mongo:
image: mongo:7
options: >-
--health-cmd "mongosh --quiet --eval \"db.adminCommand('ping')\""
--health-interval 5s
--health-timeout 5s
--health-retries 12
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Set up PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
with:
php-version: '8.5'
tools: composer:v2
extensions: ctype, iconv, mongodb
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Retrieve Server Install Action
uses: actions/checkout@v6.0.2
with:
repository: Nodarx/action-server-install
ref: main
path: action-server-install
github-server-url: https://git.ktrix.dev
- name: Configure server settings
env:
DATABASE_URI: 'mongodb://mongo:27017/?tls=false'
DATABASE_NAME: 'ktrix_ci'
APP_ENVIRONMENT: 'test'
run: php action-server-install/scripts/configure-server.php config/system.php
- name: Run tests
run: composer test:integration
+1 -3
View File
@@ -15,10 +15,8 @@ node_modules/
# Backend development # Backend development
/vendor/ /vendor/
coverage/ coverage/
.phpunit.cache *.cache
.phpunit.coverage .phpunit.coverage
.php-cs-fixer.cache
.phpstan.cache
.phpactor/ .phpactor/
# Editors # Editors
+5 -4
View File
@@ -5,7 +5,7 @@
"minimum-stability": "stable", "minimum-stability": "stable",
"prefer-stable": true, "prefer-stable": true,
"require": { "require": {
"php": ">=8.2", "php": ">=8.3",
"ext-ctype": "*", "ext-ctype": "*",
"ext-iconv": "*", "ext-iconv": "*",
"mongodb/mongodb": "^2.1", "mongodb/mongodb": "^2.1",
@@ -14,7 +14,7 @@
"symfony/console": "^7.0" "symfony/console": "^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^11.0" "phpunit/phpunit": "^12.5.31"
}, },
"config": { "config": {
"allow-plugins": { "allow-plugins": {
@@ -39,7 +39,8 @@
], ],
"post-update-cmd": [ "post-update-cmd": [
], ],
"test:unit": "phpunit --configuration tests/php/phpunit.unit.xml --colors=always --testdox", "test:unit": "phpunit --configuration tests/php/phpunit.xml --testsuite \"Unit Tests\" --colors=always --testdox",
"test:coverage": "XDEBUG_MODE=coverage phpunit --configuration tests/php/phpunit.unit.xml --coverage-html .phpunit.coverage --coverage-text" "test:integration": "phpunit --configuration tests/php/phpunit.xml --testsuite \"Integration Tests\" --colors=always --testdox",
"test:coverage": "XDEBUG_MODE=coverage phpunit --configuration tests/php/phpunit.xml --testsuite \"Unit Tests\" --coverage-html .phpunit.coverage --coverage-text"
} }
} }
Generated
+248 -332
View File
File diff suppressed because it is too large Load Diff
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace KTXT\Integration;
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));
}
}
@@ -19,7 +19,10 @@
<testsuites> <testsuites>
<testsuite name="Unit Tests"> <testsuite name="Unit Tests">
<directory>unit</directory> <directory>Unit</directory>
</testsuite>
<testsuite name="Integration Tests">
<directory>Integration</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>