diff --git a/web/modules/custom/blog/tests/modules/blog_test/opdavies_blog_test.services.yml b/web/modules/custom/blog/tests/modules/blog_test/opdavies_blog_test.services.yml index a7fd9ca..836b641 100644 --- a/web/modules/custom/blog/tests/modules/blog_test/opdavies_blog_test.services.yml +++ b/web/modules/custom/blog/tests/modules/blog_test/opdavies_blog_test.services.yml @@ -7,6 +7,3 @@ services: Drupal\opdavies_blog\Service\PostPusher\PostPusher: class: Drupal\opdavies_blog\Service\PostPusher\NullPostPusher - - Drupal\opdavies_blog_test\Factory\PostFactory: - autowire: true diff --git a/web/modules/custom/blog/tests/modules/blog_test/src/OpdaviesBlogTestServiceProvider.php b/web/modules/custom/blog/tests/modules/blog_test/src/OpdaviesBlogTestServiceProvider.php new file mode 100644 index 0000000..db0040a --- /dev/null +++ b/web/modules/custom/blog/tests/modules/blog_test/src/OpdaviesBlogTestServiceProvider.php @@ -0,0 +1,36 @@ +in(__DIR__ . '/' . $directory) + ->files() + ->name('*.php'); + + foreach ($files as $file) { + $class = 'Drupal\opdavies_blog_test\\' . $directory . '\\' . + str_replace('/', '\\', substr($file->getRelativePathname(), 0, -4)); + + if ($container->hasDefinition($class)) { + continue; + } + + $definition = new Definition($class); + $definition->setAutowired(TRUE); + $container->setDefinition($class, $definition); + } + } + } + +}