feat: CI/CD pipeline setup complete - Ansible playbooks updated, secrets configured, workflow ready

This commit is contained in:
2025-10-31 01:39:24 +01:00
parent 55c04e4fd0
commit e26eb2aa12
601 changed files with 44184 additions and 32477 deletions

View File

@@ -0,0 +1,136 @@
<?php
declare(strict_types=1);
use App\Framework\Attributes\ApiVersionAttribute;
use App\Framework\Http\Versioning\ApiVersion;
describe('ApiVersionAttribute', function () {
it('constructs with string version', function () {
$attribute = new ApiVersionAttribute('1.0.0');
expect($attribute->version)->toBeInstanceOf(ApiVersion::class);
expect($attribute->version->toString())->toBe('v1.0.0');
expect($attribute->introducedIn)->toBeNull();
expect($attribute->deprecatedIn)->toBeNull();
expect($attribute->removedIn)->toBeNull();
});
it('constructs with ApiVersion object', function () {
$version = ApiVersion::fromString('2.0.0');
$attribute = new ApiVersionAttribute($version);
expect($attribute->version)->toBe($version);
expect($attribute->version->toString())->toBe('v2.0.0');
});
it('constructs with all parameters', function () {
$attribute = new ApiVersionAttribute(
version: '2.0.0',
introducedIn: '2.0.0',
deprecatedIn: '3.0.0',
removedIn: '4.0.0'
);
expect($attribute->version->toString())->toBe('v2.0.0');
expect($attribute->introducedIn)->toBe('2.0.0');
expect($attribute->deprecatedIn)->toBe('3.0.0');
expect($attribute->removedIn)->toBe('4.0.0');
});
it('returns false for isDeprecated when not deprecated', function () {
$attribute = new ApiVersionAttribute('1.0.0');
expect($attribute->isDeprecated())->toBeFalse();
});
it('returns true for isDeprecated when deprecated', function () {
$attribute = new ApiVersionAttribute(
version: '2.0.0',
deprecatedIn: '3.0.0'
);
expect($attribute->isDeprecated())->toBeTrue();
});
it('returns false for isRemoved when not removed', function () {
$attribute = new ApiVersionAttribute('1.0.0');
expect($attribute->isRemoved())->toBeFalse();
});
it('returns true for isRemoved when removed', function () {
$attribute = new ApiVersionAttribute(
version: '2.0.0',
removedIn: '4.0.0'
);
expect($attribute->isRemoved())->toBeTrue();
});
it('returns null for getDeprecatedVersion when not deprecated', function () {
$attribute = new ApiVersionAttribute('1.0.0');
expect($attribute->getDeprecatedVersion())->toBeNull();
});
it('returns ApiVersion for getDeprecatedVersion when deprecated', function () {
$attribute = new ApiVersionAttribute(
version: '2.0.0',
deprecatedIn: '3.0.0'
);
$deprecatedVersion = $attribute->getDeprecatedVersion();
expect($deprecatedVersion)->toBeInstanceOf(ApiVersion::class);
expect($deprecatedVersion->toString())->toBe('v3.0.0');
});
it('returns null for getRemovedVersion when not removed', function () {
$attribute = new ApiVersionAttribute('1.0.0');
expect($attribute->getRemovedVersion())->toBeNull();
});
it('returns ApiVersion for getRemovedVersion when removed', function () {
$attribute = new ApiVersionAttribute(
version: '2.0.0',
removedIn: '4.0.0'
);
$removedVersion = $attribute->getRemovedVersion();
expect($removedVersion)->toBeInstanceOf(ApiVersion::class);
expect($removedVersion->toString())->toBe('v4.0.0');
});
it('returns null for getIntroducedVersion when not specified', function () {
$attribute = new ApiVersionAttribute('1.0.0');
expect($attribute->getIntroducedVersion())->toBeNull();
});
it('returns ApiVersion for getIntroducedVersion when specified', function () {
$attribute = new ApiVersionAttribute(
version: '2.0.0',
introducedIn: '2.0.0'
);
$introducedVersion = $attribute->getIntroducedVersion();
expect($introducedVersion)->toBeInstanceOf(ApiVersion::class);
expect($introducedVersion->toString())->toBe('v2.0.0');
});
it('handles version lifecycle', function () {
$attribute = new ApiVersionAttribute(
version: '2.0.0',
introducedIn: '2.0.0',
deprecatedIn: '3.0.0',
removedIn: '4.0.0'
);
expect($attribute->getIntroducedVersion()->toString())->toBe('v2.0.0');
expect($attribute->getDeprecatedVersion()->toString())->toBe('v3.0.0');
expect($attribute->getRemovedVersion()->toString())->toBe('v4.0.0');
expect($attribute->isDeprecated())->toBeTrue();
expect($attribute->isRemoved())->toBeTrue();
});
});

View File

@@ -0,0 +1,111 @@
<?php
declare(strict_types=1);
use App\Framework\Attributes\Route;
use App\Framework\Core\ValueObjects\ClassName;
use App\Framework\Core\ValueObjects\MethodName;
use App\Framework\Http\Method;
use App\Framework\Router\ValueObjects\RoutePath;
describe('Route', function () {
it('constructs with default values', function () {
$route = new Route(path: '/api/users');
expect($route->path)->toBe('/api/users');
expect($route->method)->toBe(Method::GET);
expect($route->name)->toBeNull();
expect($route->subdomain)->toBe([]);
});
it('constructs with all parameters', function () {
$route = new Route(
path: '/api/users/{id}',
method: Method::POST,
name: 'users.create',
subdomain: 'api'
);
expect($route->path)->toBe('/api/users/{id}');
expect($route->method)->toBe(Method::POST);
expect($route->name)->toBe('users.create');
expect($route->subdomain)->toBe('api');
});
it('accepts RoutePath value object as path', function () {
$routePath = RoutePath::fromString('/api/test');
$route = new Route(path: $routePath);
expect($route->path)->toBe($routePath);
expect($route->getPathAsString())->toBe('/api/test');
});
it('accepts string as path', function () {
$route = new Route(path: '/api/test');
expect($route->path)->toBe('/api/test');
expect($route->getPathAsString())->toBe('/api/test');
});
it('accepts array of subdomains', function () {
$route = new Route(
path: '/api/users',
subdomain: ['api', 'admin']
);
expect($route->subdomain)->toBe(['api', 'admin']);
});
it('returns path as string from string path', function () {
$route = new Route(path: '/api/users');
expect($route->getPathAsString())->toBe('/api/users');
});
it('returns path as string from RoutePath object', function () {
$routePath = RoutePath::fromString('/api/test');
$route = new Route(path: $routePath);
expect($route->getPathAsString())->toBe('/api/test');
});
it('returns RoutePath object from string path', function () {
$route = new Route(path: '/api/users');
$routePath = $route->getRoutePath();
expect($routePath)->toBeInstanceOf(RoutePath::class);
expect($routePath->toString())->toBe('/api/users');
});
it('returns RoutePath object when already RoutePath', function () {
$originalRoutePath = RoutePath::fromString('/api/test');
$route = new Route(path: $originalRoutePath);
$routePath = $route->getRoutePath();
expect($routePath)->toBe($originalRoutePath);
});
it('supports different HTTP methods', function () {
$getMethods = [Method::GET, Method::POST, Method::PUT, Method::DELETE, Method::PATCH];
foreach ($getMethods as $method) {
$route = new Route(path: '/api/test', method: $method);
expect($route->method)->toBe($method);
}
});
it('handles route names', function () {
$route = new Route(
path: '/api/users',
name: 'users.index'
);
expect($route->name)->toBe('users.index');
});
it('handles null route name', function () {
$route = new Route(path: '/api/users');
expect($route->name)->toBeNull();
});
});

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
use App\Framework\Attributes\Singleton;
describe('Singleton', function () {
it('can be instantiated', function () {
$singleton = new Singleton();
expect($singleton)->toBeInstanceOf(Singleton::class);
});
it('is an attribute class', function () {
$reflection = new ReflectionClass(Singleton::class);
$attributes = $reflection->getAttributes(\Attribute::class);
expect($attributes)->toHaveCount(1);
});
it('targets class only', function () {
$reflection = new ReflectionClass(Singleton::class);
$attribute = $reflection->getAttributes(\Attribute::class)[0];
$attributeInstance = $attribute->newInstance();
expect($attributeInstance->flags)->toBe(\Attribute::TARGET_CLASS);
});
});

View File

@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
use App\Framework\Attributes\StaticPage;
describe('StaticPage', function () {
it('constructs with default values', function () {
$staticPage = new StaticPage();
expect($staticPage->outputPath)->toBeNull();
expect($staticPage->prerender)->toBeTrue();
});
it('constructs with custom output path', function () {
$staticPage = new StaticPage(outputPath: 'custom/path/index.html');
expect($staticPage->outputPath)->toBe('custom/path/index.html');
expect($staticPage->prerender)->toBeTrue();
});
it('constructs with prerender disabled', function () {
$staticPage = new StaticPage(prerender: false);
expect($staticPage->outputPath)->toBeNull();
expect($staticPage->prerender)->toBeFalse();
});
it('constructs with all parameters', function () {
$staticPage = new StaticPage(
outputPath: 'static/pages/about.html',
prerender: false
);
expect($staticPage->outputPath)->toBe('static/pages/about.html');
expect($staticPage->prerender)->toBeFalse();
});
});