3
3
namespace Admingenerator \GeneratorBundle \Tests \DependencyInjection ;
4
4
5
5
use Admingenerator \GeneratorBundle \DependencyInjection \Configuration ;
6
+ use PHPUnit \Framework \TestCase ;
6
7
use Symfony \Component \Config \Definition \Processor ;
7
8
8
- class ConfigurationTest extends \PHPUnit_Framework_TestCase
9
+ class ConfigurationTest extends TestCase
9
10
{
10
11
/**
11
12
* Test that default configuration is correctly initialized
12
13
*/
13
- public function testDefaultConfig ()
14
+ public function testDefaultConfig (): void
14
15
{
15
16
$ processor = new Processor ();
16
17
$ config = $ processor ->processConfiguration (new Configuration ('admingen_generator ' ), array ());
@@ -21,13 +22,10 @@ public function testDefaultConfig()
21
22
/**
22
23
* Get waiting default values from configuration. If $key is not null
23
24
* and is in first level keys, returns value of this specific key only.
24
- *
25
- * @param string $key
26
- * @return mixed
27
25
*/
28
- private function getBundleDefaultConfig ($ key = null )
26
+ private function getBundleDefaultConfig (string $ key = null ): mixed
29
27
{
30
- static $ defaultConfiguration = array (
28
+ static $ defaultConfiguration = [
31
29
'generate_base_in_project_dir ' => false ,
32
30
'use_doctrine_orm ' => false ,
33
31
'use_doctrine_odm ' => false ,
@@ -46,22 +44,22 @@ private function getBundleDefaultConfig($key = null)
46
44
'use_doctrine_orm_batch_remove ' => false ,
47
45
'use_doctrine_odm_batch_remove ' => false ,
48
46
'use_propel_batch_remove ' => false ,
49
- 'twig ' => array (
47
+ 'twig ' => [
50
48
'use_form_resources ' => true ,
51
49
'use_localized_date ' => false ,
52
50
'date_format ' => 'Y-m-d ' ,
53
51
'datetime_format ' => 'Y-m-d H:i:s ' ,
54
52
'localized_date_format ' => 'medium ' ,
55
53
'localized_datetime_format ' => 'medium ' ,
56
- 'number_format ' => array (
54
+ 'number_format ' => [
57
55
'decimal ' => 0 ,
58
56
'decimal_point ' => '. ' ,
59
57
'thousand_separator ' => ', '
60
- )
61
- ) ,
62
- 'templates_dirs ' => array () ,
63
- 'form_types ' => array (
64
- 'doctrine_orm ' => array (
58
+ ]
59
+ ] ,
60
+ 'templates_dirs ' => [] ,
61
+ 'form_types ' => [
62
+ 'doctrine_orm ' => [
65
63
'datetime ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
66
64
'vardatetime ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
67
65
'datetimetz ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
@@ -78,8 +76,8 @@ private function getBundleDefaultConfig($key = null)
78
76
'collection ' => 'Symfony\Component\Form\Extension\Core\Type\CollectionType ' ,
79
77
'array ' => 'Symfony\Component\Form\Extension\Core\Type\CollectionType ' ,
80
78
'boolean ' => 'Symfony\Component\Form\Extension\Core\Type\CheckboxType ' ,
81
- ) ,
82
- 'doctrine_odm ' => array (
79
+ ] ,
80
+ 'doctrine_odm ' => [
83
81
'datetime ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
84
82
'timestamp ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
85
83
'vardatetime ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
@@ -101,8 +99,8 @@ private function getBundleDefaultConfig($key = null)
101
99
'collection ' => 'Symfony\Component\Form\Extension\Core\Type\CollectionType ' ,
102
100
'hash ' => 'Symfony\Component\Form\Extension\Core\Type\CollectionType ' ,
103
101
'boolean ' => 'Symfony\Component\Form\Extension\Core\Type\CheckboxType ' ,
104
- ) ,
105
- 'propel ' => array (
102
+ ] ,
103
+ 'propel ' => [
106
104
'TIMESTAMP ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
107
105
'BU_TIMESTAMP ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
108
106
'DATE ' => 'Symfony\Component\Form\Extension\Core\Type\DateType ' ,
@@ -129,10 +127,10 @@ private function getBundleDefaultConfig($key = null)
129
127
'ENUM ' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType ' ,
130
128
'BOOLEAN ' => 'Symfony\Component\Form\Extension\Core\Type\CheckboxType ' ,
131
129
'BOOLEAN_EMU ' => 'Symfony\Component\Form\Extension\Core\Type\CheckboxType ' ,
132
- ) ,
133
- ) ,
134
- 'filter_types ' => array (
135
- 'doctrine_orm ' => array (
130
+ ] ,
131
+ ] ,
132
+ 'filter_types ' => [
133
+ 'doctrine_orm ' => [
136
134
'datetime ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
137
135
'vardatetime ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
138
136
'datetimetz ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
@@ -149,8 +147,8 @@ private function getBundleDefaultConfig($key = null)
149
147
'collection ' => 'Symfony\Component\Form\Extension\Core\Type\CollectionType ' ,
150
148
'array ' => 'Symfony\Component\Form\Extension\Core\Type\TextType ' ,
151
149
'boolean ' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType ' ,
152
- ) ,
153
- 'doctrine_odm ' => array (
150
+ ] ,
151
+ 'doctrine_odm ' => [
154
152
'datetime ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
155
153
'timestamp ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
156
154
'vardatetime ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
@@ -172,8 +170,8 @@ private function getBundleDefaultConfig($key = null)
172
170
'collection ' => 'Symfony\Component\Form\Extension\Core\Type\CollectionType ' ,
173
171
'hash ' => 'Symfony\Component\Form\Extension\Core\Type\TextType ' ,
174
172
'boolean ' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType ' ,
175
- ) ,
176
- 'propel ' => array (
173
+ ] ,
174
+ 'propel ' => [
177
175
'TIMESTAMP ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
178
176
'BU_TIMESTAMP ' => 'Symfony\Component\Form\Extension\Core\Type\DateTimeType ' ,
179
177
'DATE ' => 'Symfony\Component\Form\Extension\Core\Type\DateType ' ,
@@ -200,16 +198,14 @@ private function getBundleDefaultConfig($key = null)
200
198
'ENUM ' => 'Symfony\Component\Form\Extension\Core\Type\TextType ' ,
201
199
'BOOLEAN ' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType ' ,
202
200
'BOOLEAN_EMU ' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType ' ,
203
- ) ,
204
- ) ,
205
- 'stylesheets ' => array () ,
206
- 'javascripts ' => array () ,
201
+ ] ,
202
+ ] ,
203
+ 'stylesheets ' => [] ,
204
+ 'javascripts ' => [] ,
207
205
'default_action_after_save ' => 'edit ' ,
208
206
'throw_exceptions ' => false ,
209
- 'use_doctrine_orm_batch_remove ' => false ,
210
- 'use_doctrine_odm_batch_remove ' => false ,
211
- 'use_propel_batch_remove ' => false ,
212
- );
207
+ 'generate_base_in_project_dir_directory ' => 'admin ' ,
208
+ ];
213
209
214
210
if (!is_null ($ key ) && array_key_exists ($ key , $ defaultConfiguration )) {
215
211
return $ defaultConfiguration [$ key ];
0 commit comments