function it_skips_loading_test_services_if_none_exist(Configuration $configuration, ContainerBuilder $containerBuilder, DelegatingLoaderFactory $delegatingLoaderFactory, DelegatingLoader $delegatingLoader, Filesystem $filesystem) { $configuration->getServicesFolders()->willReturn(['etc1']); $configuration->isTestEnvironment()->willReturn(true); $delegatingLoaderFactory->create($containerBuilder, 'etc1')->willReturn($delegatingLoader); $filesystem->exists('etc1/services.xml')->willReturn(true); $filesystem->exists('etc1/services_test.xml')->willReturn(false); $this->loadContainer($configuration)->shouldReturnAnInstanceOf(Container::class); $delegatingLoader->load('services.xml')->shouldHaveBeenCalled(); $delegatingLoader->load('services_test.xml')->shouldNotHaveBeenCalled(); }
/** * @param $path * * @throws FileLoaderLoadException */ private function process($path) { $loader = $this->delegatingLoaderFactory->create($this->containerBuilder, $path); $servicesFile = 'services.' . $this->servicesFormat; $servicesTestFile = 'services_test.' . $this->servicesFormat; if ($this->filesystem->exists($path . '/' . $servicesFile)) { $loader->load($servicesFile); } if ($this->isTestEnvironment && $this->filesystem->exists($path . '/' . $servicesTestFile)) { $loader->load($servicesTestFile); } }