These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\MediaBundle\Tests\DependencyInjection; |
||
4 | |||
5 | use Kunstmaan\MediaBundle\DependencyInjection\KunstmaanMediaExtension; |
||
6 | use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; |
||
7 | use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; |
||
8 | |||
9 | /** |
||
10 | * Class KunstmaanMediaExtensionTest |
||
11 | */ |
||
12 | class KunstmaanMediaExtensionTest extends AbstractExtensionTestCase |
||
13 | { |
||
14 | /** |
||
15 | * @return ExtensionInterface[] |
||
0 ignored issues
–
show
|
|||
16 | */ |
||
17 | protected function getContainerExtensions() |
||
18 | { |
||
19 | return [new KunstmaanMediaExtension()]; |
||
20 | } |
||
21 | |||
22 | public function testCorrectParametersHaveBeenSet() |
||
23 | { |
||
24 | $this->load(['enable_pdf_preview' => true]); |
||
25 | |||
26 | $this->assertContainerBuilderHasParameter('kunstmaan_media.soundcloud_api_key', 'YOUR_CLIENT_ID'); |
||
27 | $this->assertContainerBuilderHasParameter('kunstmaan_media.remote_video'); |
||
28 | $this->assertContainerBuilderHasParameter('kunstmaan_media.enable_pdf_preview', true); |
||
29 | $this->assertContainerBuilderHasParameter('kunstmaan_media.blacklisted_extensions'); |
||
30 | $this->assertContainerBuilderHasParameter('kunstmaan_media.media_manager.class', 'Kunstmaan\MediaBundle\Helper\MediaManager'); |
||
31 | $this->assertContainerBuilderHasParameter('kunstmaan_media.folder_manager.class', 'Kunstmaan\MediaBundle\Helper\FolderManager'); |
||
32 | $this->assertContainerBuilderHasParameter('kunstmaan_media.menu.adaptor.class', 'Kunstmaan\MediaBundle\Helper\Menu\MediaMenuAdaptor'); |
||
33 | $this->assertContainerBuilderHasParameter('kunstmaan_media.listener.doctrine.class', 'Kunstmaan\MediaBundle\EventListener\DoctrineMediaListener'); |
||
34 | $this->assertContainerBuilderHasParameter('kunstmaan_media.form.type.media.class', 'Kunstmaan\MediaBundle\Form\Type\MediaType'); |
||
35 | $this->assertContainerBuilderHasParameter('kunstmaan_media.form.type.iconfont.class', 'Kunstmaan\MediaBundle\Form\Type\IconFontType'); |
||
36 | $this->assertContainerBuilderHasParameter('kunstmaan_media.icon_font_manager.class', 'Kunstmaan\MediaBundle\Helper\IconFont\IconFontManager'); |
||
37 | $this->assertContainerBuilderHasParameter('kunstmaan_media.icon_font.default_loader.class', 'Kunstmaan\MediaBundle\Helper\IconFont\DefaultIconFontLoader'); |
||
38 | $this->assertContainerBuilderHasParameter('kunstmaan_media.media_creator_service.class', 'Kunstmaan\MediaBundle\Helper\Services\MediaCreatorService'); |
||
39 | $this->assertContainerBuilderHasParameter('kunstmaan_media.mimetype_guesser.factory.class', 'Kunstmaan\MediaBundle\Helper\MimeTypeGuesserFactory'); |
||
40 | $this->assertContainerBuilderHasParameter('kunstmaan_media.extension_guesser.factory.class', 'Kunstmaan\MediaBundle\Helper\ExtensionGuesserFactory'); |
||
41 | $this->assertContainerBuilderHasParameter('kunstmaan_media.validator.has_guessable_extension.class', 'Kunstmaan\MediaBundle\Validator\Constraints\HasGuessableExtensionValidator'); |
||
42 | $this->assertContainerBuilderHasParameter('kunstmaan_media.media_handler.remote_slide.class', 'Kunstmaan\MediaBundle\Helper\RemoteSlide\RemoteSlideHandler'); |
||
43 | $this->assertContainerBuilderHasParameter('kunstmaan_media.media_handler.remote_video.class', 'Kunstmaan\MediaBundle\Helper\RemoteVideo\RemoteVideoHandler'); |
||
44 | $this->assertContainerBuilderHasParameter('kunstmaan_media.media_handler.remote_audio.class', 'Kunstmaan\MediaBundle\Helper\RemoteAudio\RemoteAudioHandler'); |
||
45 | $this->assertContainerBuilderHasParameter('kunstmaan_media.media_handler.image.class', 'Kunstmaan\MediaBundle\Helper\Image\ImageHandler'); |
||
46 | $this->assertContainerBuilderHasParameter('kunstmaan_media.media_handler.file.class', 'Kunstmaan\MediaBundle\Helper\File\FileHandler'); |
||
47 | $this->assertContainerBuilderHasParameter('kunstmaan_media.aviary_api_key', null); |
||
48 | $this->assertContainerBuilderHasParameter('kunstmaan_media.media_path', '/uploads/media/'); |
||
49 | $this->assertContainerBuilderHasParameter('liip_imagine.filter.loader.background.class', 'Kunstmaan\MediaBundle\Helper\Imagine\BackgroundFilterLoader'); |
||
50 | } |
||
51 | |||
52 | public function testAviaryApiKeyWithNoConfig() |
||
53 | { |
||
54 | $this->load(); |
||
55 | |||
56 | $this->assertContainerBuilderHasParameter('kunstmaan_media.aviary_api_key', null); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @group legacy |
||
61 | * @expectedDeprecation Not providing a value for the "kunstmaan_media.aviary_api_key" config while setting the "aviary_api_key" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "aviary_api_key" parameter in KunstmaanDashboardBundle 6.0. |
||
62 | */ |
||
63 | public function testAviaryApiKeyWithParameterSet() |
||
64 | { |
||
65 | $this->setParameter('aviary_api_key', 'api_key'); |
||
66 | |||
67 | $this->load(); |
||
68 | |||
69 | $this->assertContainerBuilderHasParameter('kunstmaan_media.aviary_api_key', 'api_key'); |
||
70 | } |
||
71 | |||
72 | public function testAviaryApiKeyWithParameterAndConfigSet() |
||
73 | { |
||
74 | $this->setParameter('aviary_api_key', 'api_key'); |
||
75 | |||
76 | $this->load(['aviary_api_key' => 'other_api_key']); |
||
77 | |||
78 | $this->assertContainerBuilderHasParameter('kunstmaan_media.aviary_api_key', 'other_api_key'); |
||
79 | } |
||
80 | } |
||
81 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.