1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Sonata Project package. |
7
|
|
|
* |
8
|
|
|
* (c) Thomas Rabaix <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Sonata\NewsBundle\Tests\DependencyInjection; |
15
|
|
|
|
16
|
|
|
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase; |
17
|
|
|
use Sonata\NewsBundle\DependencyInjection\Configuration; |
18
|
|
|
use Sonata\NewsBundle\DependencyInjection\SonataNewsExtension; |
19
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
20
|
|
|
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; |
21
|
|
|
|
22
|
|
|
final class ConfigurationTest extends AbstractExtensionConfigurationTestCase |
23
|
|
|
{ |
24
|
|
|
public function testDefault(): void |
25
|
|
|
{ |
26
|
|
|
$this->assertProcessedConfigurationEquals([ |
27
|
|
|
'title' => 'Foo title', |
28
|
|
|
'link' => '/foo/bar', |
29
|
|
|
'description' => 'Foo description', |
30
|
|
|
'salt' => 'pepper', |
31
|
|
|
'permalink_generator' => 'sonata.news.permalink.date', |
32
|
|
|
'permalink' => [ |
33
|
|
|
'date' => '%%1$04d/%%2$d/%%3$d/%%4$s', |
34
|
|
|
], |
35
|
|
|
'db_driver' => 'doctrine_orm', |
36
|
|
|
'table' => [ |
37
|
|
|
'post_tag' => 'news__post_tag', |
38
|
|
|
], |
39
|
|
|
'class' => [ |
40
|
|
|
'tag' => 'Application\Sonata\ClassificationBundle\Entity\Tag', |
41
|
|
|
'collection' => 'Application\Sonata\ClassificationBundle\Entity\Collection', |
42
|
|
|
'post' => 'Application\Sonata\NewsBundle\Entity\Post', |
43
|
|
|
'comment' => 'Application\Sonata\NewsBundle\Entity\Comment', |
44
|
|
|
'media' => 'Application\Sonata\MediaBundle\Entity\Media', |
45
|
|
|
'user' => 'Application\Sonata\UserBundle\Entity\User', |
46
|
|
|
], |
47
|
|
|
'admin' => [ |
48
|
|
|
'post' => [ |
49
|
|
|
'class' => 'Sonata\NewsBundle\Admin\PostAdmin', |
50
|
|
|
'controller' => 'SonataAdminBundle:CRUD', |
51
|
|
|
'translation' => 'SonataNewsBundle', |
52
|
|
|
], |
53
|
|
|
'comment' => [ |
54
|
|
|
'class' => 'Sonata\NewsBundle\Admin\CommentAdmin', |
55
|
|
|
'controller' => 'SonataNewsBundle:CommentAdmin', |
56
|
|
|
'translation' => 'SonataNewsBundle', |
57
|
|
|
], |
58
|
|
|
], |
59
|
|
|
], [ |
60
|
|
|
__DIR__.'/../Fixtures/configuration.yaml', |
61
|
|
|
]); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
protected function getContainerExtension(): ExtensionInterface |
65
|
|
|
{ |
66
|
|
|
return new SonataNewsExtension(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
protected function getConfiguration(): ConfigurationInterface |
70
|
|
|
{ |
71
|
|
|
return new Configuration(); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|