Skip to content

Commit

Permalink
Merge pull request #1404 from garak/fix-config
Browse files Browse the repository at this point in the history
fix configuration
  • Loading branch information
garak authored Nov 6, 2023
2 parents e531a93 + 6fe2b9d commit b8ec542
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
- run: composer require --no-update oneup/flysystem-bundle:"^4.0.1"
if: matrix.with_oneupbundle
- name: Update project dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private function addMappingsSection(ArrayNodeDefinition $node): void
->scalarNode('uri_prefix')->defaultValue('/uploads')->end()
->scalarNode('upload_destination')->isRequired()->end()
->arrayNode('namer')
->addDefaultsIfNotSet()
->isRequired()
->beforeNormalization()
->ifString()
->then(static fn ($v) => ['service' => $v, 'options' => []])
Expand Down
20 changes: 10 additions & 10 deletions tests/DependencyInjection/VichUploaderExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testStorageServiceParameterIsSet(): void
'storage' => 'gaufrette',
]);

self::assertContainerBuilderHasAlias('vich_uploader.storage', 'vich_uploader.storage.gaufrette');
$this->assertContainerBuilderHasAlias('vich_uploader.storage', 'vich_uploader.storage.gaufrette');
}

public function testStorageServiceCustom(): void
Expand All @@ -53,7 +53,7 @@ public function testStorageServiceCustom(): void
'storage' => '@acme.storage',
]);

self::assertContainerBuilderHasAlias('vich_uploader.storage', 'acme.storage');
$this->assertContainerBuilderHasAlias('vich_uploader.storage', 'acme.storage');
}

public function testExtraServiceFilesAreLoaded(): void
Expand All @@ -63,8 +63,8 @@ public function testExtraServiceFilesAreLoaded(): void
'storage' => 'flysystem',
]);

self::assertContainerBuilderHasService('vich_uploader.storage.flysystem', FlysystemStorage::class);
self::assertContainerBuilderHasService(UploaderExtension::class);
$this->assertContainerBuilderHasService('vich_uploader.storage.flysystem', FlysystemStorage::class);
$this->assertContainerBuilderHasService(UploaderExtension::class);
}

public function testMappingsServiceParameterIsSet(): void
Expand All @@ -86,7 +86,7 @@ public function testMappingsServiceParameterIsSet(): void
// the default db_driver is copied into the mapping
$mappings['foo']['db_driver'] = 'orm';

self::assertContainerBuilderHasParameter('vich_uploader.mappings', $mappings);
$this->assertContainerBuilderHasParameter('vich_uploader.mappings', $mappings);
}

public function testDbDriverIsNotOverridden(): void
Expand All @@ -107,7 +107,7 @@ public function testDbDriverIsNotOverridden(): void
],
]);

self::assertContainerBuilderHasParameter('vich_uploader.mappings', $mappings);
$this->assertContainerBuilderHasParameter('vich_uploader.mappings', $mappings);
}

public function testListenersCreation(): void
Expand All @@ -127,9 +127,9 @@ public function testListenersCreation(): void
],
]);

self::assertContainerBuilderHasService('vich_uploader.listener.inject.profile_common_avatar');
self::assertContainerBuilderNotHasService('vich_uploader.listener.clean.profile_common_avatar');
self::assertContainerBuilderHasService('vich_uploader.listener.remove.profile_common_avatar');
$this->assertContainerBuilderHasService('vich_uploader.listener.inject.profile_common_avatar');
$this->assertContainerBuilderNotHasService('vich_uploader.listener.clean.profile_common_avatar');
$this->assertContainerBuilderHasService('vich_uploader.listener.remove.profile_common_avatar');
}

public function testFormThemeCorrectlyOverridden(): void
Expand All @@ -147,7 +147,7 @@ public function testFormThemeCorrectlyOverridden(): void
]], $this->container);
$vichUploaderExtension->load([$this->getMinimalConfiguration()], $this->container);

self::assertContainerBuilderHasParameter(
$this->assertContainerBuilderHasParameter(
'twig.form.resources',
['@VichUploader/Form/fields.html.twig', 'form_div_layout.html.twig', '@Ololo/trololo.html.twig']
);
Expand Down
2 changes: 2 additions & 0 deletions tests/Kernel/FlysystemOfficialAppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Vich\UploaderBundle\VichUploaderBundle;
use Vich\UploaderBundle\Naming\UniqidNamer;

/**
* @author Titouan Galopin <[email protected]>
Expand Down Expand Up @@ -56,6 +57,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
'product_image' => [
'uri_prefix' => '/images/products',
'upload_destination' => 'uploads.storage',
'namer' => UniqidNamer::class,
],
],
]);
Expand Down
2 changes: 2 additions & 0 deletions tests/Kernel/FlysystemOneUpAppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Vich\UploaderBundle\Naming\UniqidNamer;
use Vich\UploaderBundle\VichUploaderBundle;

/**
Expand Down Expand Up @@ -61,6 +62,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
'product_image' => [
'uri_prefix' => '/images/products',
'upload_destination' => 'oneup_flysystem.product_image_fs',
'namer' => UniqidNamer::class,
],
],
]);
Expand Down

0 comments on commit b8ec542

Please sign in to comment.