1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
<?php
namespace Illuminate\Tests\Integration\Foundation;
use Illuminate\Foundation\Cloud;
use Orchestra\Testbench\Attributes\WithConfig;
use Orchestra\Testbench\TestCase;
class CloudTest extends TestCase
{
#[WithConfig('database.connections.pgsql', ['host' => 'test-pooler.pg.laravel.cloud', 'username' => 'test-username', 'password' => 'test-password'])]
public function test_it_can_resolve_core_container_aliases()
{
Cloud::configureUnpooledPostgresConnection($this->app);
$this->assertEquals([
'host' => 'test.pg.laravel.cloud',
'username' => 'test-username',
'password' => 'test-password',
], $this->app['config']->get('database.connections.pgsql-unpooled'));
}
public function test_it_can_configure_disks()
{
$_SERVER['LARAVEL_CLOUD_DISK_CONFIG'] = json_encode(
[
[
'disk' => 'test-disk',
'access_key_id' => 'test-access-key-id',
'access_key_secret' => 'test-access-key-secret',
'bucket' => 'test-bucket',
'url' => 'test-url',
'endpoint' => 'test-endpoint',
'is_default' => false,
],
[
'disk' => 'test-disk-2',
'access_key_id' => 'test-access-key-id-2',
'access_key_secret' => 'test-access-key-secret-2',
'bucket' => 'test-bucket-2',
'url' => 'test-url-2',
'endpoint' => 'test-endpoint-2',
'is_default' => true,
],
]
);
Cloud::configureDisks($this->app);
$this->assertEquals('test-disk-2', $this->app['config']->get('filesystems.default'));
$this->assertEquals('test-access-key-id', $this->app['config']->get('filesystems.disks.test-disk.key'));
unset($_SERVER['LARAVEL_CLOUD_DISK_CONFIG']);
}
}
|