From 216903aa08502be8eea7cdeb742bf85f303926ab Mon Sep 17 00:00:00 2001 From: l3l0 Date: Fri, 22 Feb 2013 17:29:35 +0100 Subject: [PATCH] Add configuration for AclAmazonS3. Replaces #31 --- .travis.yml | 2 +- .../Factory/AclAwareAmazonS3AdapterFactory.php | 7 ++++++- Tests/Functional/ConfigurationTest.php | 11 +++++++++++ composer.json | 6 +++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 517a42a..ec77bf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ before_script: - php composer.phar install --dev script: - - phpunit --coverage-text + - php bin/phpunit --coverage-text diff --git a/DependencyInjection/Factory/AclAwareAmazonS3AdapterFactory.php b/DependencyInjection/Factory/AclAwareAmazonS3AdapterFactory.php index 03fc8a8..3bb150a 100644 --- a/DependencyInjection/Factory/AclAwareAmazonS3AdapterFactory.php +++ b/DependencyInjection/Factory/AclAwareAmazonS3AdapterFactory.php @@ -18,9 +18,14 @@ class AclAwareAmazonS3AdapterFactory implements AdapterFactoryInterface ->setDefinition($id.'.delegate', new DefinitionDecorator('knp_gaufrette.adapter.amazon_s3')) ->addArgument(new Reference($config['amazon_s3_id'])) ->addArgument($config['bucket_name']) - ->addArgument($config['create']) ; + if (isset($config['options'])) { + $definition->addArgument($config['options']); + } elseif (isset($config['create'])) { + $definition->addArgument(array('create' => $config['create'])); + } + $def = $container ->setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.acl_aware_amazon_s3')) ->addArgument(new Reference($id.'.delegate')) diff --git a/Tests/Functional/ConfigurationTest.php b/Tests/Functional/ConfigurationTest.php index 47602c3..f47b845 100644 --- a/Tests/Functional/ConfigurationTest.php +++ b/Tests/Functional/ConfigurationTest.php @@ -34,6 +34,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldAllowForFilesystemAlias() { @@ -42,6 +43,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldWorkForOtherEnv() { @@ -54,6 +56,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldAllowAccessToAllPublicServices() { @@ -70,6 +73,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldAllowAccessToLocalFilesystem() { @@ -78,6 +82,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldAllowAccessToCacheFilesystem() { @@ -86,6 +91,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldAllowAccessToFtpFilesystem() { @@ -94,6 +100,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldAllowToNotConfigureStreamWrapper() { @@ -102,6 +109,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldConfigureStreamWrapperWithDefaultValues() { @@ -127,6 +135,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldAllowToDefineProtocolOfStreamWrapper() { @@ -140,6 +149,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldAllowToDefineWhichFileSystemsShouldBeAddToStreamWrapper() { @@ -159,6 +169,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /** * @test + * @functional */ public function shouldAllowToDefineFileSystemsWithoutDomain() { diff --git a/composer.json b/composer.json index 144d565..29521b9 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ }, "require-dev": { "symfony/yaml": "2.*", - "symfony/console": "2.*" + "symfony/console": "2.*", + "phpunit/phpunit": "3.7.*" }, "autoload": { "psr-0": { @@ -33,5 +34,8 @@ "dev-master": "0.2.x-dev" } }, + "config": { + "bin-dir": "bin" + }, "target-dir": "Knp/Bundle/GaufretteBundle" }