/**
  * @dataProvider getAddServicesTests
  */
 public function testAddService($serviceClass, $serviceName, $serviceArguments, $serviceFctory, $startingConfig, $expectedConfig)
 {
     $configurationPath = $this->tmpDir . '/services.yml';
     file_put_contents($configurationPath, $startingConfig);
     $manipulator = new ServiceConfigurationManipulator($configurationPath);
     $manipulator->addService($serviceClass, $serviceName, $serviceArguments, $serviceFctory);
     $resultConfig = file_get_contents($configurationPath);
     $this->assertEquals($expectedConfig, $resultConfig);
 }
コード例 #2
0
 protected function registerServices($forceOverwrite)
 {
     $service = new ServiceConfigurationManipulator($this->bundle->getPath() . '/Resources/config/services.yml', $forceOverwrite);
     $service->addService($this->bundle->getName() . '\\Handler\\' . $this->entity . 'Handler', 'app.handler.' . $this->entityUnderscored, ['@app.repository.' . $this->entityUnderscored, '@app.services.response_builder', '@form.factory', '@router']);
     $service->addService($this->bundle->getName() . '\\Services\\APIResponseBuilder', 'app.services.response_builder', ['@validator']);
     $service->addService($this->bundle->getName() . '\\Repository\\' . $this->entity . 'Repository', 'app.repository.' . $this->entityUnderscored, [$this->bundle->getName() . '\\Entity\\' . $this->entity], ['@doctrine.orm.entity_manager', 'getRepository']);
 }