17 Commits

Author SHA1 Message Date
Sebastian 1c6c0837b3 chore(deps): update dependency jsdom to v30
Build Test / test (pull_request) Successful in 33s
JS Unit Tests / test (pull_request) Successful in 43s
PHP Integration Tests / Integration Tests (pull_request) Failing after 1m9s
PHP Unit Tests / test (pull_request) Successful in 1m12s
2026-07-29 03:02:50 +00:00
Sebastian 26ee6e9c33 refactor: migrate to scoped execution contexts
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-07-27 00:50:43 -04:00
Sebastian eb78c5149a Merge pull request 'chore: implement js test suites' (#33) from chore/js-test-suites into main
Reviewed-on: #33
2026-07-24 04:25:28 +00:00
Sebastian 861abac4b4 chore: implement js test suites
Build Test / test (pull_request) Successful in 51s
JS Unit Tests / test (pull_request) Successful in 39s
PHP Integration Tests / Integration Tests (pull_request) Successful in 2m0s
PHP Unit Tests / test (pull_request) Successful in 2m18s
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-07-24 00:13:45 -04:00
Sebastian 314294c37b Merge pull request 'chore(deps): update mongo docker tag to v8' (#32) from renovate/mongo-8.x into main
Reviewed-on: #32
2026-07-24 03:28:36 +00:00
Sebastian 6609ad5d8b chore(deps): update mongo docker tag to v8
PHP Unit Tests / test (pull_request) Successful in 1m24s
PHP Integration Tests / Integration Tests (pull_request) Successful in 2m21s
2026-07-24 03:17:13 +00:00
Sebastian 9b701bf2a0 Merge pull request 'chore(deps): update dependency pinia to v4.0.2' (#29) from renovate/pinia-4.x-lockfile into main
Reviewed-on: #29
2026-07-24 02:36:44 +00:00
Sebastian b51941c45e Merge pull request 'chore: implement php test suites' (#30) from chore/php83-test-suites into main
Reviewed-on: #30
2026-07-24 02:36:37 +00:00
Sebastian ed1a21157b fix: install module dependencies before running integration tests
PHP Integration Tests / Integration Tests (pull_request) Successful in 1m21s
PHP Unit Tests / test (pull_request) Successful in 55s
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-07-23 22:32:07 -04:00
Sebastian e9904b8500 chore: implement php test suites
PHP Unit Tests / test (pull_request) Successful in 1m9s
PHP Integration Tests / Integration Tests (pull_request) Failing after 1m38s
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-07-23 22:20:36 -04:00
Sebastian d81b758a01 chore(deps): update dependency pinia to v4.0.2 2026-07-18 03:02:40 +00:00
Sebastian 39eed88cf5 Merge pull request 'chore(deps): update dependency vite to v8.1.5' (#26) from renovate/vite-8.x-lockfile into main
Reviewed-on: #26
2026-07-17 23:21:04 +00:00
Sebastian e4ce58cdd3 Merge pull request 'fix(deps): update dependency pinia to v4' (#27) from renovate/pinia-4.x into main
Reviewed-on: #27
2026-07-17 23:20:57 +00:00
Sebastian c4e3659fd6 Merge pull request 'chore(deps): update dependency vue to v3.5.40' (#28) from renovate/vue-monorepo into main
Reviewed-on: #28
2026-07-17 23:20:53 +00:00
Sebastian 77ae86562e chore(deps): update dependency vue to v3.5.40 2026-07-17 03:05:29 +00:00
Sebastian 0a133c65bc chore(deps): update dependency vite to v8.1.5 2026-07-17 03:05:26 +00:00
Sebastian 7c314dfcbe fix(deps): update dependency pinia to v4 2026-07-15 03:05:28 +00:00
17 changed files with 3271 additions and 496 deletions
+42
View File
@@ -0,0 +1,42 @@
name: Build Test
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- 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: Install Server
uses: ./action-server-install
with:
install-php: 'false'
install-node: 'true'
php-version: '8.5'
node-version: '24'
server-path: './server'
- name: Checkout Pull Request
uses: actions/checkout@v6.0.2
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.head.sha }}
path: server/modules/documents_manager
github-server-url: https://git.ktrix.dev
- name: Install dependencies
run: npm ci
working-directory: server/modules/documents_manager
- name: Build
run: npm run build
working-directory: server/modules/documents_manager
+42
View File
@@ -0,0 +1,42 @@
name: JS Unit Tests
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- 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: Install Server
uses: ./action-server-install
with:
install-php: 'false'
install-node: 'true'
php-version: '8.5'
node-version: '24'
server-path: './server'
- name: Checkout Pull Request
uses: actions/checkout@v6.0.2
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.head.sha }}
path: server/modules/documents_manager
github-server-url: https://git.ktrix.dev
- name: Install dependencies
run: npm ci
working-directory: server/modules/documents_manager
- name: Run tests
run: npm run test:unit
working-directory: server/modules/documents_manager
@@ -0,0 +1,59 @@
name: PHP Integration Tests
on:
pull_request:
workflow_dispatch:
jobs:
test:
name: Integration Tests
runs-on: ubuntu-latest
services:
mongo:
image: mongo:8
options: >-
--health-cmd "mongosh --quiet --eval \"db.adminCommand('ping')\""
--health-interval 5s
--health-timeout 5s
--health-retries 12
steps:
- 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: Install server
uses: ./action-server-install
with:
install-php: 'true'
php-version: '8.5'
server-path: './server'
database-uri: 'mongodb://mongo:27017/?tls=false'
database-name: 'ktrix_ci'
app-environment: 'test'
- name: Checkout module under test
uses: actions/checkout@v6.0.2
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.head.sha || github.sha }}
path: server/modules/documents_manager
github-server-url: https://git.ktrix.dev
- name: Install module dependencies
run: composer install --prefer-dist --no-progress
working-directory: server/modules/documents_manager
- name: Install and enable module
working-directory: server
run: |
php bin/console module:install documents_manager
php bin/console module:enable documents_manager
- name: Run integration tests
working-directory: server/modules/documents_manager
run: composer test:integration
+42
View File
@@ -0,0 +1,42 @@
name: PHP Unit Tests
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- 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: Install Server
uses: ./action-server-install
with:
install-php: 'true'
install-node: 'false'
php-version: '8.5'
node-version: '24'
server-path: './server'
- name: Checkout Pull Request
uses: actions/checkout@v6.0.2
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.head.sha }}
path: server/modules/documents_manager
github-server-url: https://git.ktrix.dev
- name: Install dependencies
run: composer install --prefer-dist --no-progress
working-directory: server/modules/documents_manager
- name: Run tests
run: composer test:unit
working-directory: server/modules/documents_manager
+1 -4
View File
@@ -15,10 +15,7 @@ node_modules/
/vendor/
/lib/vendor/
coverage/
phpunit.xml.cache
.phpunit.result.cache
.php-cs-fixer.cache
.phpstan.cache
*.cache
.phpactor/
# Editors
+14 -2
View File
@@ -10,17 +10,29 @@
"config": {
"optimize-autoloader": true,
"platform": {
"php": "8.2"
"php": "8.3"
},
"autoloader-suffix": "DocumentsManager",
"vendor-dir": "lib/vendor"
},
"require": {
"php": ">=8.2 <=8.5"
"php": ">=8.3 <=8.5"
},
"require-dev": {
"phpunit/phpunit": "^12.0"
},
"autoload": {
"psr-4": {
"KTXM\\DocumentsManager\\": "lib/"
}
},
"autoload-dev": {
"psr-4": {
"KTXT\\DocumentsManager\\Tests\\": "tests/php/"
}
},
"scripts": {
"test:unit": "phpunit --configuration tests/php/phpunit.xml --testsuite \"Unit Tests\" --colors=always --testdox",
"test:integration": "phpunit --configuration tests/php/phpunit.xml --testsuite \"Integration Tests\" --colors=always --testdox"
}
}
Generated
+1686 -4
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -13,8 +13,8 @@ use InvalidArgumentException;
use KTXC\Http\Response\JsonResponse;
use KTXC\Http\Response\Response;
use KTXC\Http\Response\StreamedNdJsonResponse;
use KTXC\SessionIdentity;
use KTXC\SessionTenant;
use KTXC\Context\IdentityContextInterface;
use KTXC\Context\TenantContextInterface;
use KTXF\Controller\ControllerAbstract;
use KTXF\Json\JsonSerializable;
use KTXF\Resource\Identifier\CollectionIdentifier;
@@ -51,8 +51,8 @@ class DefaultController extends ControllerAbstract {
private const ERR_TARGET_ENTITY = 'Invalid parameter: target must be provider:service:collection:entity';
public function __construct(
private readonly SessionTenant $tenantIdentity,
private readonly SessionIdentity $userIdentity,
private readonly TenantContextInterface $tenantContext,
private readonly IdentityContextInterface $identityContext,
private readonly Manager $manager,
private readonly LoggerInterface $logger
) {}
@@ -80,8 +80,8 @@ class DefaultController extends ControllerAbstract {
): Response {
// authorize request
$tenantId = $this->tenantIdentity->identifier();
$userId = $this->userIdentity->identifier();
$tenantId = $this->tenantContext->identifier();
$userId = $this->identityContext->identifier();
try {
+10 -10
View File
@@ -12,8 +12,8 @@ namespace KTXM\DocumentsManager\Controllers;
use KTXC\Http\Response\JsonResponse;
use KTXC\Http\Response\Response;
use KTXC\Http\Response\StreamedResponse;
use KTXC\SessionIdentity;
use KTXC\SessionTenant;
use KTXC\Context\IdentityContextInterface;
use KTXC\Context\TenantContextInterface;
use KTXF\Controller\ControllerAbstract;
use KTXF\Documents\Collection\CollectionBaseInterface;
use KTXF\Documents\Entity\EntityBaseInterface;
@@ -39,8 +39,8 @@ use Throwable;
class TransferController extends ControllerAbstract
{
public function __construct(
private readonly SessionTenant $tenantIdentity,
private readonly SessionIdentity $userIdentity,
private readonly TenantContextInterface $tenantContext,
private readonly IdentityContextInterface $identityContext,
private readonly Manager $manager,
private readonly LoggerInterface $logger
) {}
@@ -56,8 +56,8 @@ class TransferController extends ControllerAbstract
methods: ['GET']
)]
public function downloadEntity(string $provider, string $service, string $collection, string $identifier): Response {
$tenantId = $this->tenantIdentity->identifier();
$userId = $this->userIdentity->identifier();
$tenantId = $this->tenantContext->identifier();
$userId = $this->identityContext->identifier();
try {
$target = new EntityIdentifier($provider, $service, $collection, $identifier);
@@ -135,8 +135,8 @@ class TransferController extends ControllerAbstract
methods: ['GET']
)]
public function downloadArchive(string $provider, string $service, array $ids = [], ?string $collection = null, string $name = 'download'): Response {
$tenantId = $this->tenantIdentity->identifier();
$userId = $this->userIdentity->identifier();
$tenantId = $this->tenantContext->identifier();
$userId = $this->identityContext->identifier();
if (empty($ids)) {
return new JsonResponse([
@@ -221,8 +221,8 @@ class TransferController extends ControllerAbstract
methods: ['GET']
)]
public function downloadCollection(string $provider, string $service, string $identifier): Response {
$tenantId = $this->tenantIdentity->identifier();
$userId = $this->userIdentity->identifier();
$tenantId = $this->tenantContext->identifier();
$userId = $this->identityContext->identifier();
try {
// Fetch collection metadata
+1181 -466
View File
File diff suppressed because it is too large Load Diff
+11 -4
View File
@@ -7,17 +7,24 @@
"build": "vite build --mode production --config vite.config.ts",
"dev": "vite build --mode development --config vite.config.ts",
"watch": "vite build --mode development --watch --config vite.config.ts",
"typecheck": "vue-tsc --noEmit"
"typecheck": "vue-tsc --noEmit",
"test": "vitest run --config tests/js/vitest.config.ts",
"test:unit": "vitest run --config tests/js/vitest.config.ts",
"test:watch": "vitest watch --config tests/js/vitest.config.ts",
"test:coverage": "vitest run --coverage --config tests/js/vitest.config.ts"
},
"dependencies": {
"pinia": "^3.0.0",
"pinia": "^4.0.0",
"vue": "^3.5.13"
},
"devDependencies": {
"@tsconfig/node24": "^24.0.0",
"@types/node": "^24.0.0",
"@vue/tsconfig": "^0.9.0",
"typescript": "~7.0.0",
"vite": "^8.0.0"
"typescript": "~6.0.0",
"vite": "^8.0.0",
"@vitest/coverage-v8": "^4.1.6",
"jsdom": "^30.0.0",
"vitest": "^4.1.6"
}
}
+30
View File
@@ -0,0 +1,30 @@
import { describe, it, expect } from 'vitest'
describe('Basic Tests', () => {
it('should perform basic assertion', () => {
expect(true).toBe(true)
})
it('should test array operations', () => {
const array = ['foo', 'bar', 'baz']
expect(array).toHaveLength(3)
expect(array).toContain('bar')
expect(array[0]).toBe('foo')
})
it('should test string operations', () => {
const string = 'Hello, World!'
expect(string).toContain('World')
expect(string.length).toBe(13)
})
it('should test object operations', () => {
const obj = { foo: 'bar', count: 42 }
expect(obj).toHaveProperty('foo')
expect(obj.foo).toBe('bar')
expect(obj.count).toBeGreaterThan(40)
})
})
+31
View File
@@ -0,0 +1,31 @@
import { fileURLToPath } from 'node:url'
import { defineConfig, configDefaults } from 'vitest/config'
import path from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, '../../src'),
'@KTXC': path.resolve(__dirname, '../../../../core/src'),
},
},
test: {
environment: 'jsdom',
exclude: [...configDefaults.exclude, 'e2e/**'],
root: fileURLToPath(new URL('../../', import.meta.url)),
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'tests/',
'**/*.d.ts',
'**/*.config.*',
'**/dist/**',
],
},
},
})
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace KTXT\DocumentsManager\Tests\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));
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace KTXT\DocumentsManager\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));
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
require dirname(__DIR__, 2).'/lib/vendor/autoload.php';
// When this module is checked out inside a full server (server/modules/<handle>,
// as it is in CI and in this monorepo checkout), also load the server's own
// core/shared autoloader so tests can reference framework (KTXC/KTXF) types.
// Standalone module checkouts without a server alongside them skip this.
define('SERVER_ROOT', dirname(__DIR__, 4));
$serverAutoload = SERVER_ROOT . '/vendor/autoload.php';
if (is_file($serverAutoload)) {
require $serverAutoload;
}
if (isset($_SERVER['APP_DEBUG']) && $_SERVER['APP_DEBUG']) {
umask(0000);
}
+41
View File
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
failOnDeprecation="true"
failOnNotice="true"
failOnWarning="true"
bootstrap="bootstrap.php"
cacheDirectory="../../.phpunit.cache"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
</php>
<testsuites>
<testsuite name="Unit Tests">
<directory>Unit</directory>
</testsuite>
<testsuite name="Integration Tests">
<directory>Integration</directory>
</testsuite>
</testsuites>
<source ignoreSuppressionOfDeprecations="true"
ignoreIndirectDeprecations="true"
restrictNotices="true"
restrictWarnings="true"
>
<include>
<directory>../../lib</directory>
</include>
</source>
<extensions>
</extensions>
</phpunit>