/** * @return void */ public function testProcess() { $baseNamespace = 'Graviton\\DocumentBundle\\Tests\\DependencyInjection\\CompilerPass\\Resources\\Document'; $containerDouble = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerBuilder')->disableOriginalConstructor()->getMock(); $containerDouble->expects($this->once())->method('setParameter')->with('graviton.document.form.type.document.field_map', ['stdclass' => [], $baseNamespace . '\\A' => [['id', 'text', ['property_path' => 'id']], ['integerA', 'integer', ['property_path' => 'integer']], ['titleA', 'translatable', ['property_path' => 'title']], ['extrefA', 'extref', ['property_path' => 'extref']], ['booleanA', 'strictboolean', ['property_path' => 'boolean']], ['datetimeA', 'datetime', ['property_path' => 'datetime']], ['floatA', 'number', ['property_path' => 'float']], ['unstructA', 'freeform', ['property_path' => 'unstruct']], ['achild', 'form', ['property_path' => 'achild', 'data_class' => $baseNamespace . '\\B', 'required' => false]], ['achildren', 'collection', ['property_path' => 'achildren', 'type' => 'form', 'options' => ['data_class' => $baseNamespace . '\\B']]]], $baseNamespace . '\\B' => [['id', 'text', ['property_path' => 'id']], ['fieldB', 'text', ['property_path' => 'field']], ['bchild', 'form', ['property_path' => 'bchild', 'data_class' => $baseNamespace . '\\C', 'required' => true]], ['bchildren', 'collection', ['property_path' => 'bchildren', 'type' => 'form', 'options' => ['data_class' => $baseNamespace . '\\C']]]], $baseNamespace . '\\C' => [['id', 'text', ['property_path' => 'id']], ['fieldC', 'text', ['property_path' => 'field']]]]); $documentMap = new DocumentMap((new Finder())->in(__DIR__ . '/Resources/doctrine/form')->name('*.mongodb.xml'), (new Finder())->in(__DIR__ . '/Resources/serializer/form')->name('*.xml'), (new Finder())->in(__DIR__ . '/Resources/validation/form')->name('*.xml')); $compilerPass = new DocumentFormFieldsCompilerPass($documentMap); $compilerPass->process($containerDouble); }
/** * @return void */ public function testProcess() { $containerDouble = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder'); $serviceDouble = $this->getMock('Symfony\\Component\\DependencyInjection\\Definition'); $containerDouble->method('getDefinition')->willReturn($serviceDouble); $containerDouble->expects($this->at(0))->method('getParameter')->with('graviton.document.form.type.document.service_map')->willReturn(['graviton.core.controller.app' => '%graviton.core.document.app.class%']); $containerDouble->expects($this->at(1))->method('findTaggedServiceIds')->with('graviton.rest')->willReturn([]); $containerDouble->expects($this->once())->method('setParameter')->with($this->equalTo('graviton.document.form.type.document.field_map'), ['stdclass' => []]); $sut = new DocumentFormFieldsCompilerPass(); $sut->process($containerDouble); }