Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
@@ -28,7 +28,7 @@ test('wirft Exception bei nicht existierender Datei', function () {
|
||||
$storage = new FileStorage();
|
||||
$nonExistingFile = '/tmp/doesnt_exist_' . uniqid();
|
||||
|
||||
expect(fn() => $storage->get($nonExistingFile))
|
||||
expect(fn () => $storage->get($nonExistingFile))
|
||||
->toThrow(FileNotFoundException::class);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,27 +1,132 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Framework\Filesystem;
|
||||
|
||||
use App\Framework\Filesystem\File;
|
||||
use App\Framework\Filesystem\Directory;
|
||||
use App\Framework\Filesystem\FilesystemFactory;
|
||||
use App\Framework\Filesystem\InMemoryStorage;
|
||||
use App\Framework\Filesystem\File;
|
||||
use App\Framework\Filesystem\FileStorage;
|
||||
use App\Framework\Filesystem\InMemoryStorage;
|
||||
use App\Framework\Filesystem\PermissionChecker;
|
||||
use App\Framework\Filesystem\Storage;
|
||||
|
||||
it('lädt File-Properties erst bei Bedarf', function() {
|
||||
it('lädt File-Properties erst bei Bedarf', function () {
|
||||
// Test-Storage mit Instrumentierung
|
||||
$storage = new class extends InMemoryStorage {
|
||||
$baseStorage = new InMemoryStorage();
|
||||
$storage = new class ($baseStorage) implements Storage {
|
||||
public array $accessed = [];
|
||||
|
||||
public function get(string $path): string {
|
||||
$this->accessed[] = "get:{$path}";
|
||||
return parent::get($path);
|
||||
public function __construct(private InMemoryStorage $baseStorage)
|
||||
{
|
||||
}
|
||||
|
||||
public function size(string $path): int {
|
||||
public function get(string $path): string
|
||||
{
|
||||
$this->accessed[] = "get:{$path}";
|
||||
|
||||
return $this->baseStorage->get($path);
|
||||
}
|
||||
|
||||
public function size(string $path): int
|
||||
{
|
||||
$this->accessed[] = "size:{$path}";
|
||||
return parent::size($path);
|
||||
|
||||
return $this->baseStorage->size($path);
|
||||
}
|
||||
|
||||
// All other methods delegate to base storage
|
||||
public function put(string $path, string $content): void
|
||||
{
|
||||
$this->baseStorage->put($path, $content);
|
||||
}
|
||||
|
||||
public function exists(string $path): bool
|
||||
{
|
||||
return $this->baseStorage->exists($path);
|
||||
}
|
||||
|
||||
public function delete(string $path): void
|
||||
{
|
||||
$this->baseStorage->delete($path);
|
||||
}
|
||||
|
||||
public function copy(string $source, string $destination): void
|
||||
{
|
||||
$this->baseStorage->copy($source, $destination);
|
||||
}
|
||||
|
||||
public function lastModified(string $path): int
|
||||
{
|
||||
return $this->baseStorage->lastModified($path);
|
||||
}
|
||||
|
||||
public function addFile(string $path, string $content): void
|
||||
{
|
||||
$this->baseStorage->addFile($path, $content);
|
||||
}
|
||||
|
||||
public function getMimeType(string $path): string
|
||||
{
|
||||
return $this->baseStorage->getMimeType($path);
|
||||
}
|
||||
|
||||
public function isReadable(string $path): bool
|
||||
{
|
||||
return $this->baseStorage->isReadable($path);
|
||||
}
|
||||
|
||||
public function isWritable(string $path): bool
|
||||
{
|
||||
return $this->baseStorage->isWritable($path);
|
||||
}
|
||||
|
||||
public function listDirectory(string $directory): array
|
||||
{
|
||||
return $this->baseStorage->listDirectory($directory);
|
||||
}
|
||||
|
||||
public function createDirectory(string $path, int $permissions = 0755, bool $recursive = true): void
|
||||
{
|
||||
$this->baseStorage->createDirectory($path, $permissions, $recursive);
|
||||
}
|
||||
|
||||
public function file(string $path): File
|
||||
{
|
||||
return $this->baseStorage->file($path);
|
||||
}
|
||||
|
||||
public function directory(string $path): Directory
|
||||
{
|
||||
return $this->baseStorage->directory($path);
|
||||
}
|
||||
|
||||
public function batch(array $operations): array
|
||||
{
|
||||
return $this->baseStorage->batch($operations);
|
||||
}
|
||||
|
||||
public function getMultiple(array $paths): array
|
||||
{
|
||||
return $this->baseStorage->getMultiple($paths);
|
||||
}
|
||||
|
||||
public function putMultiple(array $files): void
|
||||
{
|
||||
$this->baseStorage->putMultiple($files);
|
||||
}
|
||||
|
||||
public function getMetadataMultiple(array $paths): array
|
||||
{
|
||||
return $this->baseStorage->getMetadataMultiple($paths);
|
||||
}
|
||||
|
||||
public PermissionChecker $permissions {
|
||||
get => $this->baseStorage->permissions;
|
||||
}
|
||||
|
||||
public \App\Framework\Async\FiberManager $fiberManager {
|
||||
get => $this->baseStorage->fiberManager;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,14 +154,120 @@ it('lädt File-Properties erst bei Bedarf', function() {
|
||||
expect($size)->toBe(10); // Länge von 'Testinhalt'
|
||||
});
|
||||
|
||||
it('lädt Directory-Properties erst bei Bedarf', function() {
|
||||
it('lädt Directory-Properties erst bei Bedarf', function () {
|
||||
// Test-Storage mit Instrumentierung
|
||||
$storage = new class extends InMemoryStorage {
|
||||
$baseStorage = new InMemoryStorage();
|
||||
$storage = new class ($baseStorage) implements Storage {
|
||||
public array $accessed = [];
|
||||
|
||||
public function listDirectory(string $directory): array {
|
||||
public function __construct(private InMemoryStorage $baseStorage)
|
||||
{
|
||||
}
|
||||
|
||||
public function listDirectory(string $directory): array
|
||||
{
|
||||
$this->accessed[] = "list:{$directory}";
|
||||
return parent::listDirectory($directory);
|
||||
|
||||
return $this->baseStorage->listDirectory($directory);
|
||||
}
|
||||
|
||||
// Delegate all other methods to base storage
|
||||
public function get(string $path): string
|
||||
{
|
||||
return $this->baseStorage->get($path);
|
||||
}
|
||||
|
||||
public function put(string $path, string $content): void
|
||||
{
|
||||
$this->baseStorage->put($path, $content);
|
||||
}
|
||||
|
||||
public function exists(string $path): bool
|
||||
{
|
||||
return $this->baseStorage->exists($path);
|
||||
}
|
||||
|
||||
public function delete(string $path): void
|
||||
{
|
||||
$this->baseStorage->delete($path);
|
||||
}
|
||||
|
||||
public function copy(string $source, string $destination): void
|
||||
{
|
||||
$this->baseStorage->copy($source, $destination);
|
||||
}
|
||||
|
||||
public function size(string $path): int
|
||||
{
|
||||
return $this->baseStorage->size($path);
|
||||
}
|
||||
|
||||
public function lastModified(string $path): int
|
||||
{
|
||||
return $this->baseStorage->lastModified($path);
|
||||
}
|
||||
|
||||
public function getMimeType(string $path): string
|
||||
{
|
||||
return $this->baseStorage->getMimeType($path);
|
||||
}
|
||||
|
||||
public function isReadable(string $path): bool
|
||||
{
|
||||
return $this->baseStorage->isReadable($path);
|
||||
}
|
||||
|
||||
public function isWritable(string $path): bool
|
||||
{
|
||||
return $this->baseStorage->isWritable($path);
|
||||
}
|
||||
|
||||
public function createDirectory(string $path, int $permissions = 0755, bool $recursive = true): void
|
||||
{
|
||||
$this->baseStorage->createDirectory($path, $permissions, $recursive);
|
||||
}
|
||||
|
||||
public function file(string $path): File
|
||||
{
|
||||
return $this->baseStorage->file($path);
|
||||
}
|
||||
|
||||
public function directory(string $path): Directory
|
||||
{
|
||||
return $this->baseStorage->directory($path);
|
||||
}
|
||||
|
||||
public function batch(array $operations): array
|
||||
{
|
||||
return $this->baseStorage->batch($operations);
|
||||
}
|
||||
|
||||
public function getMultiple(array $paths): array
|
||||
{
|
||||
return $this->baseStorage->getMultiple($paths);
|
||||
}
|
||||
|
||||
public function putMultiple(array $files): void
|
||||
{
|
||||
$this->baseStorage->putMultiple($files);
|
||||
}
|
||||
|
||||
public function getMetadataMultiple(array $paths): array
|
||||
{
|
||||
return $this->baseStorage->getMetadataMultiple($paths);
|
||||
}
|
||||
|
||||
public function addFile(string $path, string $content): void
|
||||
{
|
||||
$this->baseStorage->addFile($path, $content);
|
||||
}
|
||||
|
||||
public PermissionChecker $permissions {
|
||||
get => $this->baseStorage->permissions;
|
||||
}
|
||||
|
||||
public \App\Framework\Async\FiberManager $fiberManager {
|
||||
get => $this->baseStorage->fiberManager;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -81,11 +292,11 @@ it('lädt Directory-Properties erst bei Bedarf', function() {
|
||||
expect($contents)->toHaveCount(2);
|
||||
});
|
||||
|
||||
it('kann mit echtem FileStorage arbeiten', function() {
|
||||
it('kann mit echtem FileStorage arbeiten', function () {
|
||||
// Dieser Test kann übersprungen werden, wenn keine Schreibrechte im Temp-Verzeichnis vorhanden sind
|
||||
$tempDir = sys_get_temp_dir() . '/php-lazy-test-' . uniqid();
|
||||
@mkdir($tempDir, 0777, true);
|
||||
if (!is_dir($tempDir) || !is_writable($tempDir)) {
|
||||
if (! is_dir($tempDir) || ! is_writable($tempDir)) {
|
||||
$this->markTestSkipped('Kein Schreibzugriff im Temp-Verzeichnis');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user