Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function cleanupAdminTestDirectory(
}

it('discovers classes with AdminSection attribute in a module', function (): void {
$tempDir = sys_get_temp_dir() . '/marko-admin-discovery-test-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-admin-discovery-test-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

$classCode = <<<'PHP'
Expand Down Expand Up @@ -81,7 +81,7 @@ public function getMenuItems(): array { return []; }
});

it('skips classes without AdminSection attribute', function (): void {
$tempDir = sys_get_temp_dir() . '/marko-admin-discovery-test-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-admin-discovery-test-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

$classCode = <<<'PHP'
Expand Down Expand Up @@ -150,7 +150,7 @@ public function help(): void {}
});

it('returns empty array when module has no admin sections', function (): void {
$tempDir = sys_get_temp_dir() . '/marko-admin-discovery-test-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-admin-discovery-test-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

// Create a PHP file without AdminSection attribute
Expand Down Expand Up @@ -184,8 +184,8 @@ public function execute(): void {}
});

it('discovers sections across multiple modules', function (): void {
$tempDir1 = sys_get_temp_dir() . '/marko-admin-discovery-test-' . uniqid();
$tempDir2 = sys_get_temp_dir() . '/marko-admin-discovery-test-' . uniqid();
$tempDir1 = sys_get_temp_dir() . '/marko-admin-discovery-test-' . bin2hex(random_bytes(8));
$tempDir2 = sys_get_temp_dir() . '/marko-admin-discovery-test-' . bin2hex(random_bytes(8));
mkdir($tempDir1 . '/src', 0755, true);
mkdir($tempDir2 . '/src', 0755, true);

Expand Down
4 changes: 2 additions & 2 deletions packages/cache-file/tests/Unit/FileCacheDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

function getCacheTestPath(): string
{
return sys_get_temp_dir() . '/marko-cache-test-' . uniqid();
return sys_get_temp_dir() . '/marko-cache-test-' . bin2hex(random_bytes(8));
}

function cleanupCacheTestPath(
Expand Down Expand Up @@ -282,7 +282,7 @@ function writeExpiredCacheEntry(
})->throws(InvalidKeyException::class, 'Invalid cache key');

it('creates cache directory if not exists', function (): void {
$newPath = sys_get_temp_dir() . '/marko-cache-new-' . uniqid();
$newPath = sys_get_temp_dir() . '/marko-cache-new-' . bin2hex(random_bytes(8));
$config = createTestCacheConfig($newPath);
$driver = new FileCacheDriver($config);

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tests/CliKernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

function createTempProjectDir(): string
{
$tempDir = sys_get_temp_dir() . '/marko-cli-test-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-cli-test-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/vendor/marko/core', 0755, true);

return $tempDir;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tests/ProjectFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function removeDirectory(

function createTempDir(): string
{
return sys_get_temp_dir() . '/marko-test-' . uniqid();
return sys_get_temp_dir() . '/marko-test-' . bin2hex(random_bytes(8));
}

it('finds project root when in project directory', function () {
Expand Down
14 changes: 7 additions & 7 deletions packages/config/tests/Feature/ConfigIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

it('config file uses environment variable when set', function () {
// Create temporary directory structure
$tempDir = sys_get_temp_dir() . '/marko-config-env-test-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-config-env-test-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/app-config', 0755, true);

try {
Expand Down Expand Up @@ -126,7 +126,7 @@

it('config file uses default when environment variable is not set', function () {
// Create temporary directory structure
$tempDir = sys_get_temp_dir() . '/marko-config-env-default-test-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-config-env-default-test-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/app-config', 0755, true);

try {
Expand Down Expand Up @@ -181,7 +181,7 @@

it('throws ConfigLoadException when config file has PHP syntax error', function () {
// Create temporary directory structure
$tempDir = sys_get_temp_dir() . '/marko-config-syntax-error-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-config-syntax-error-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/app-config', 0755, true);

try {
Expand Down Expand Up @@ -217,7 +217,7 @@

it('throws ConfigLoadException when config file returns non-array', function () {
// Create temporary directory structure
$tempDir = sys_get_temp_dir() . '/marko-config-non-array-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-config-non-array-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/app-config', 0755, true);

try {
Expand Down Expand Up @@ -249,7 +249,7 @@

it('full config lifecycle with temporary module structure', function () {
// Create temporary directory structure
$tempDir = sys_get_temp_dir() . '/marko-config-test-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-config-test-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/module-x/config', 0755, true);
mkdir($tempDir . '/module-y/config', 0755, true);
mkdir($tempDir . '/app-config', 0755, true);
Expand Down Expand Up @@ -325,7 +325,7 @@

it('multi-tenant scenario with default and scoped values', function () {
// Create temporary directory structure
$tempDir = sys_get_temp_dir() . '/marko-config-multitenant-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-config-multitenant-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/app-config', 0755, true);

try {
Expand Down Expand Up @@ -397,7 +397,7 @@

it('withScope creates properly scoped instance for multi-tenant access', function () {
// Create temporary directory structure
$tempDir = sys_get_temp_dir() . '/marko-config-withscope-' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko-config-withscope-' . bin2hex(random_bytes(8));
mkdir($tempDir . '/app-config', 0755, true);

try {
Expand Down
26 changes: 13 additions & 13 deletions packages/core/tests/Command/CommandDiscoveryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

it('discovers command classes in module src directories', function (): void {
// Create a temp directory structure with command files
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

// Create a command class file with Command attribute
Expand Down Expand Up @@ -60,7 +60,7 @@ public function execute(

it('ignores classes without Command attribute', function (): void {
// Create a temp directory structure
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

// Create a class without Command attribute
Expand Down Expand Up @@ -97,7 +97,7 @@ public function doSomething(): void {}

it('ignores directories without src folder', function (): void {
// Create a temp directory without src folder
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir, 0755, true);

$manifest = new ModuleManifest(
Expand All @@ -117,7 +117,7 @@ public function doSomething(): void {}

it('returns array of CommandDefinition objects', function (): void {
// Create a temp directory structure with command files
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

$commandCode = <<<'PHP'
Expand Down Expand Up @@ -164,7 +164,7 @@ public function execute(
});

it('extracts command name from attribute', function (): void {
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

$commandCode = <<<'PHP'
Expand Down Expand Up @@ -211,7 +211,7 @@ public function execute(
});

it('extracts description from attribute', function (): void {
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

$commandCode = <<<'PHP'
Expand Down Expand Up @@ -258,7 +258,7 @@ public function execute(
});

it('throws CommandException when command class missing execute method', function (): void {
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

// Create a command class without execute method (and without interface so it can load)
Expand Down Expand Up @@ -297,7 +297,7 @@ class MissingExecuteCommand
});

it('throws CommandException when command class does not implement CommandInterface', function (): void {
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

// Create a command class with execute method but not implementing interface
Expand Down Expand Up @@ -339,7 +339,7 @@ public function execute(): int
});

it('discovers aliases from Command attribute', function (): void {
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

$commandCode = <<<'PHP'
Expand Down Expand Up @@ -386,7 +386,7 @@ public function execute(
});

it('creates CommandDefinition with empty aliases when none specified', function (): void {
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

$commandCode = <<<'PHP'
Expand Down Expand Up @@ -433,7 +433,7 @@ public function execute(
});

it('creates CommandDefinition with aliases when specified in attribute', function (): void {
$tempDir = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir . '/src', 0755, true);

$commandCode = <<<'PHP'
Expand Down Expand Up @@ -481,7 +481,7 @@ public function execute(

it('discovers commands from multiple modules', function (): void {
// Create first module
$tempDir1 = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir1 = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir1 . '/src', 0755, true);

$commandCode1 = <<<'PHP'
Expand Down Expand Up @@ -510,7 +510,7 @@ public function execute(
file_put_contents($tempDir1 . '/src/ModuleACommand.php', $commandCode1);

// Create second module
$tempDir2 = sys_get_temp_dir() . '/marko_test_' . uniqid();
$tempDir2 = sys_get_temp_dir() . '/marko_test_' . bin2hex(random_bytes(8));
mkdir($tempDir2 . '/src', 0755, true);

$commandCode2 = <<<'PHP'
Expand Down
Loading