Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix configuration #1404

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <galopintitouan@gmail.com>
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