mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
Refactor TempUrlOpenstackGenerator to use parameter bag and Bundle configuration
The TempUrlOpenstackGenerator now uses a ParameterBag for configuration instead of individual parameters. This simplifies the handling of configuration values and makes the code more maintainable. The parameter configuration has also been included in the chill_doc_store configuration array for a unified approach.
This commit is contained in:
@@ -17,6 +17,7 @@ use Chill\DocStoreBundle\AsyncUpload\SignedUrlPost;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\NullLogger;
|
||||
use Symfony\Component\Clock\MockClock;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
/**
|
||||
@@ -34,16 +35,28 @@ class TempUrlOpenstackGeneratorTest extends TestCase
|
||||
$logger = new NullLogger();
|
||||
$eventDispatcher = new EventDispatcher();
|
||||
$clock = new MockClock($now);
|
||||
$parameters = new ParameterBag(
|
||||
[
|
||||
'chill_doc_store' => [
|
||||
'openstack' => [
|
||||
'temp_url' => [
|
||||
'temp_url_key' => $key,
|
||||
'temp_url_base_path' => $baseUrl,
|
||||
'max_post_file_size' => 150,
|
||||
'max_post_file_count' => 1,
|
||||
'max_expires_delay' => 1800,
|
||||
'max_submit_delay' => 1800,
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$generator = new TempUrlOpenstackGenerator(
|
||||
$logger,
|
||||
$eventDispatcher,
|
||||
$clock,
|
||||
$baseUrl,
|
||||
$key,
|
||||
1800,
|
||||
1800,
|
||||
150
|
||||
$parameters,
|
||||
);
|
||||
|
||||
$signedUrl = $generator->generate($method, $objectName, $expireDelay);
|
||||
@@ -59,16 +72,28 @@ class TempUrlOpenstackGeneratorTest extends TestCase
|
||||
$logger = new NullLogger();
|
||||
$eventDispatcher = new EventDispatcher();
|
||||
$clock = new MockClock($now);
|
||||
$parameters = new ParameterBag(
|
||||
[
|
||||
'chill_doc_store' => [
|
||||
'openstack' => [
|
||||
'temp_url' => [
|
||||
'temp_url_key' => $key,
|
||||
'temp_url_base_path' => $baseUrl,
|
||||
'max_post_file_size' => 150,
|
||||
'max_post_file_count' => 1,
|
||||
'max_expires_delay' => 1800,
|
||||
'max_submit_delay' => 1800,
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$generator = new TempUrlOpenstackGenerator(
|
||||
$logger,
|
||||
$eventDispatcher,
|
||||
$clock,
|
||||
$baseUrl,
|
||||
$key,
|
||||
1800,
|
||||
1800,
|
||||
150
|
||||
$parameters,
|
||||
);
|
||||
|
||||
$signedUrl = $generator->generatePost();
|
||||
|
Reference in New Issue
Block a user