@@ -120,7 +120,16 @@ public function testEnableCache()
120
120
$ this ->extension ->load (array_merge_recursive (self ::$ defaultConfig , ['dunglas_api ' => ['cache ' => true ]]), $ containerBuilder );
121
121
}
122
122
123
- private function getContainerBuilderProphecy ()
123
+ public function testDisableDoctrine ()
124
+ {
125
+ $ containerBuilderProphecy = $ this ->getContainerBuilderProphecy (false );
126
+ $ containerBuilderProphecy ->removeDefinition ('api.cache_warmer.metadata ' )->shouldBeCalled ();
127
+ $ containerBuilder = $ containerBuilderProphecy ->reveal ();
128
+
129
+ $ this ->extension ->load (array_merge_recursive (self ::$ defaultConfig , ['dunglas_api ' => ['enable_doctrine_orm ' => false ]]), $ containerBuilder );
130
+ }
131
+
132
+ private function getContainerBuilderProphecy ($ withDoctrine = true )
124
133
{
125
134
$ parameterBagProphecy = $ this ->prophesize ('Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface ' );
126
135
$ parameterBagProphecy ->add (Argument::any ())->shouldBeCalled ();
@@ -148,7 +157,6 @@ private function getContainerBuilderProphecy()
148
157
$ containerBuilderProphecy ->setDefinition ('api.router ' , $ definitionArgument )->shouldBeCalled ();
149
158
$ containerBuilderProphecy ->setDefinition ('api.iri_converter ' , $ definitionArgument )->shouldBeCalled ();
150
159
$ containerBuilderProphecy ->setDefinition ('api.property_info ' , $ definitionArgument )->shouldBeCalled ();
151
- $ containerBuilderProphecy ->setDefinition ('api.property_info.doctrine_extractor ' , $ definitionArgument )->shouldBeCalled ();
152
160
$ containerBuilderProphecy ->setDefinition ('api.property_info.php_doc_extractor ' , $ definitionArgument )->shouldBeCalled ();
153
161
$ containerBuilderProphecy ->setDefinition ('api.property_info.setter_extractor ' , $ definitionArgument )->shouldBeCalled ();
154
162
$ containerBuilderProphecy ->setDefinition ('api.mapping.class_metadata_factory ' , $ definitionArgument )->shouldBeCalled ();
@@ -159,14 +167,6 @@ private function getContainerBuilderProphecy()
159
167
$ containerBuilderProphecy ->setDefinition ('api.mapping.loaders.validator_metadata ' , $ definitionArgument )->shouldBeCalled ();
160
168
$ containerBuilderProphecy ->setDefinition ('api.mapping.loaders.phpdoc ' , $ definitionArgument )->shouldBeCalled ();
161
169
$ containerBuilderProphecy ->setDefinition ('api.mapping.loaders.annotation ' , $ definitionArgument )->shouldBeCalled ();
162
- $ containerBuilderProphecy ->setDefinition ('api.doctrine.metadata_factory ' , $ definitionArgument )->shouldBeCalled ();
163
- $ containerBuilderProphecy ->setDefinition ('api.doctrine.event_subscriber ' , $ definitionArgument )->shouldBeCalled ();
164
- $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.data_provider ' , $ definitionArgument )->shouldBeCalled ();
165
- $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.default_data_provider ' , $ definitionArgument )->shouldBeCalled ();
166
- $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.search_filter ' , $ definitionArgument )->shouldBeCalled ();
167
- $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.order_filter ' , $ definitionArgument )->shouldBeCalled ();
168
- $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.date_filter ' , $ definitionArgument )->shouldBeCalled ();
169
- $ containerBuilderProphecy ->setDefinition ('api.mapping.loaders.doctrine_identifier ' , $ definitionArgument )->shouldBeCalled ();
170
170
$ containerBuilderProphecy ->setDefinition ('api.json_ld.entrypoint_builder ' , $ definitionArgument )->shouldBeCalled ();
171
171
$ containerBuilderProphecy ->setDefinition ('api.json_ld.context_builder ' , $ definitionArgument )->shouldBeCalled ();
172
172
$ containerBuilderProphecy ->setDefinition ('api.json_ld.resource_context_builder_listener ' , $ definitionArgument )->shouldBeCalled ();
@@ -180,6 +180,28 @@ private function getContainerBuilderProphecy()
180
180
$ containerBuilderProphecy ->setDefinition ('api.hydra.normalizer.constraint_violation_list ' , $ definitionArgument )->shouldBeCalled ();
181
181
$ containerBuilderProphecy ->setDefinition ('api.hydra.normalizer.error ' , $ definitionArgument )->shouldBeCalled ();
182
182
183
+ if ($ withDoctrine ) {
184
+ $ definitionProphecy = $ this ->prophesize ('Symfony\Component\DependencyInjection\Definition ' );
185
+ $ definitionProphecy ->getArgument (Argument::exact (0 ))->willReturn ([])->shouldBeCalled ();
186
+ $ definitionProphecy ->replaceArgument (Argument::exact (0 ), Argument::type ('array ' ))->shouldBeCalled ();
187
+ $ definition = $ definitionProphecy ->reveal ();
188
+
189
+ $ containerBuilderProphecy ->getDefinition ('api.property_info ' )->shouldBeCalled ()->willReturn ($ definition );
190
+ $ containerBuilderProphecy ->getDefinition ('api.property_info.doctrine_extractor ' )->shouldBeCalled ()->willReturn ($ definition );
191
+ $ containerBuilderProphecy ->getDefinition ('api.mapping.loaders.chain ' )->shouldBeCalled ()->willReturn ($ definition );
192
+ $ containerBuilderProphecy ->getDefinition ('api.mapping.loaders.doctrine_identifier ' )->shouldBeCalled ()->willReturn ($ definition );
193
+
194
+ $ containerBuilderProphecy ->setDefinition ('api.doctrine.metadata_factory ' , $ definitionArgument )->shouldBeCalled ();
195
+ $ containerBuilderProphecy ->setDefinition ('api.doctrine.event_subscriber ' , $ definitionArgument )->shouldBeCalled ();
196
+ $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.data_provider ' , $ definitionArgument )->shouldBeCalled ();
197
+ $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.default_data_provider ' , $ definitionArgument )->shouldBeCalled ();
198
+ $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.search_filter ' , $ definitionArgument )->shouldBeCalled ();
199
+ $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.order_filter ' , $ definitionArgument )->shouldBeCalled ();
200
+ $ containerBuilderProphecy ->setDefinition ('api.doctrine.orm.date_filter ' , $ definitionArgument )->shouldBeCalled ();
201
+ $ containerBuilderProphecy ->setDefinition ('api.mapping.loaders.doctrine_identifier ' , $ definitionArgument )->shouldBeCalled ();
202
+ $ containerBuilderProphecy ->setDefinition ('api.property_info.doctrine_extractor ' , $ definitionArgument )->shouldBeCalled ();
203
+ }
204
+
183
205
return $ containerBuilderProphecy ;
184
206
}
185
207
}
0 commit comments