fix: DockerSecretsResolver - don't normalize absolute paths like /var/www/html/...
Some checks failed
Deploy Application / deploy (push) Has been cancelled

This commit is contained in:
2025-11-24 21:28:25 +01:00
parent 4eb7134853
commit 77abc65cd7
1327 changed files with 91915 additions and 9909 deletions

View File

@@ -3,12 +3,15 @@
declare(strict_types=1);
use App\Framework\Config\AppConfig;
use App\Framework\Config\Environment;
use App\Framework\Config\DiscoveryConfig;
use App\Framework\Config\External\ExternalApiConfig;
use App\Framework\Config\SecurityConfig;
use App\Framework\Config\TypedConfiguration;
use App\Framework\Core\Application;
use App\Framework\Core\Events\EventDispatcherInterface;
use App\Framework\Core\RequestLifecycleObserver;
use App\Framework\Core\ValueObjects\Version;
use App\Framework\Database\Config\DatabaseConfig;
use App\Framework\DI\Container;
use App\Framework\DI\DefaultContainer;
@@ -23,9 +26,13 @@ use App\Framework\Http\Request;
use App\Framework\Http\RequestStateManager;
use App\Framework\Http\ResponseEmitter;
use App\Framework\Http\Status;
use App\Framework\Logging\DefaultLogger;
use App\Framework\Logging\Logger;
use App\Framework\Logging\InMemoryLogger;
use App\Framework\Performance\Contracts\PerformanceCollectorInterface;
use App\Framework\Performance\PerformanceCategory;
use App\Framework\Performance\PerformanceMetric;
use App\Framework\RateLimit\RateLimitConfig;
use App\Framework\Router\CompiledRoutes;
use App\Framework\Router\HttpRouter;
// Simple test doubles
@@ -41,6 +48,56 @@ class TestEventDispatcher implements EventDispatcherInterface
}
}
class NullPerformanceCollector implements PerformanceCollectorInterface
{
public function startTiming(string $key, PerformanceCategory $category, array $context = []): void {}
public function endTiming(string $key): void {}
public function measure(string $key, PerformanceCategory $category, callable $callback, array $context = []): mixed
{
return $callback();
}
public function recordMetric(string $key, PerformanceCategory $category, float $value, array $context = []): void {}
public function increment(string $key, PerformanceCategory $category, int $amount = 1, array $context = []): void {}
public function getMetrics(?PerformanceCategory $category = null): array
{
return [];
}
public function getMetric(string $key): ?PerformanceMetric
{
return null;
}
public function getTotalRequestTime(): float
{
return 0.0;
}
public function getTotalRequestMemory(): int
{
return 0;
}
public function getPeakMemory(): int
{
return 0;
}
public function reset(): void {}
public function isEnabled(): bool
{
return false;
}
public function setEnabled(bool $enabled): void {}
}
class TestMiddleware
{
public function __invoke(MiddlewareContext $context, HttpMiddlewareChainInterface $next, RequestStateManager $stateManager): MiddlewareContext
@@ -95,7 +152,7 @@ beforeEach(function () {
database: $databaseConfig,
app: new AppConfig(
name: 'Test App',
version: '1.0.0-test',
version: Version::fromString('1.0.0-test'),
environment: 'testing',
debug: true,
timezone: \App\Framework\DateTime\Timezone::UTC
@@ -114,29 +171,41 @@ beforeEach(function () {
discovery: new DiscoveryConfig()
);
$this->request = new HttpRequest(
method: Method::GET,
path: '/test'
);
$this->responseEmitter = new ResponseEmitter();
// Register essential dependencies in container
$this->container->bind(Logger::class, new DefaultLogger());
$this->container->bind(Logger::class, new InMemoryLogger());
$this->container->bind(HttpRouter::class, new class () {});
$this->container->bind(\App\Framework\Cache\Cache::class, new \App\Framework\Cache\GeneralCache(new \App\Framework\Cache\Driver\InMemoryCache(), new \App\Framework\Serializer\Php\PhpSerializer()));
// Register Request for handleRequest
$this->container->bind(Request::class, new HttpRequest(
method: Method::GET,
path: '/test'
));
$this->container->bind(Request::class, $this->request);
// Create test doubles
$this->middlewareManager = new TestMiddlewareManager($this->container);
$this->eventDispatcher = new TestEventDispatcher();
$this->lifecycleObserver = new RequestLifecycleObserver(
$this->eventDispatcher,
new NullPerformanceCollector()
);
$this->router = new HttpRouter(
new CompiledRoutes([], [], []),
new Environment(['APP_URL' => 'https://example.test'])
);
$this->application = new Application(
$this->container,
$this->responseEmitter,
$this->config,
$this->request,
$this->middlewareManager,
$this->eventDispatcher
$this->responseEmitter,
$this->lifecycleObserver,
$this->eventDispatcher,
$this->router
);
});
@@ -145,8 +214,8 @@ it('creates application with dependencies', function () {
});
it('gets config values correctly', function () {
expect($this->application->config('environment'))->toBe('testing');
expect($this->application->config('app.version'))->toBe('1.0.0-test');
expect($this->application->config('app.environment'))->toBe('testing');
expect((string) $this->application->config('app.version'))->toBe('1.0.0-test');
expect($this->application->config('nonexistent', 'default'))->toBe('default');
expect($this->application->config('nonexistent'))->toBeNull();
});
@@ -172,5 +241,5 @@ it('verifies interface extraction allows dependency injection with test doubles'
expect($this->eventDispatcher)->toBeInstanceOf(EventDispatcherInterface::class);
// Verify the Application is using our test doubles (not container-resolved instances)
expect($this->application->config('environment'))->toBe('testing');
expect($this->application->config('app.environment'))->toBe('testing');
});