Skip to content

Commit 6c99f34

Browse files
committed
fix(tests): fix storage configuration
1 parent cadfb85 commit 6c99f34

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

.github/workflows/tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ jobs:
5959
sleep 2
6060
done
6161
62+
- name: Wait for MinIO bucket initialization
63+
run: |
64+
echo "Waiting for MinIO bucket initialization..."
65+
docker wait bowphp_minio_init || true
66+
6267
- name: Cache Composer packages
6368
id: composer-cache
6469
uses: actions/cache@v4

tests/Config/stubs/config/storage.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@
3939
's3' => [
4040
"driver" => "s3",
4141
'credentials' => [
42-
'key' => app_env('AWS_KEY', 'minioadmin'),
43-
'secret' => app_env('AWS_SECRET', 'minioadmin'),
42+
// `?:` so an unset env (which CI exposes as an empty string)
43+
// falls back to the local docker-compose MinIO defaults.
44+
'key' => app_env('AWS_KEY') ?: 'minioadmin',
45+
'secret' => app_env('AWS_SECRET') ?: 'minioadmin',
4446
],
45-
'bucket' => app_env('AWS_S3_BUCKET', 'tests'),
46-
'region' => app_env('AWS_REGION', 'us-east-1'),
47+
'bucket' => app_env('AWS_S3_BUCKET') ?: 'tests',
48+
'region' => app_env('AWS_REGION') ?: 'us-east-1',
4749
'version' => 'latest',
4850
// MinIO configuration. Defaults target the local docker-compose
4951
// MinIO service; override via env for a real AWS S3 endpoint.
50-
'endpoint' => app_env('AWS_ENDPOINT', 'http://127.0.0.1:9000'),
52+
'endpoint' => app_env('AWS_ENDPOINT') ?: 'http://127.0.0.1:9000',
5153
'use_path_style_endpoint' => true, // Set to true for MinIO
5254
]
5355
],

tests/Routing/AttributeRouteIntegrationTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,14 @@ protected function setUp(): void
4141
{
4242
parent::setUp();
4343

44-
// Reset the router for each test
4544
$this->router = Router::configure();
45+
46+
// The route collection is a global (static) registry that intentionally
47+
// gathers routes across every Router instance. Clear it before each test
48+
// so assertions are not polluted by routes registered by earlier tests.
49+
$routes = new \ReflectionProperty(Router::class, 'routes');
50+
$routes->setAccessible(true);
51+
$routes->setValue(null, []);
4652
}
4753

4854
public function test_registrar_registers_routes_from_controller(): void

0 commit comments

Comments
 (0)