diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c227b20 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +root = true + +[*.yaml] +indent_style = space +indent_size = 4 diff --git a/config/services.yaml b/config/services.yaml index 5c4b417..8b90440 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -8,20 +8,23 @@ parameters: services: # default configuration for services in *this* file _defaults: - autowire: true # Automatically injects dependencies in your services. + autowire: true # Automatically injects dependencies in your services. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name App\: - resource: '../src/*' - exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' + resource: "../src/*" + exclude: "../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}" # controllers are imported separately to make sure services can be injected # as action arguments even if you don't extend any base controller class App\Controller\: - resource: '../src/Controller' - tags: ['controller.service_arguments'] + resource: "../src/Controller" + tags: ["controller.service_arguments"] # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones + App\EventRepository: + class: App\Tests\FakeEventRepository + public: true diff --git a/tests/FakeEventRepositoryTest.php b/tests/FakeEventRepositoryTest.php index 1c298d4..4462bd8 100644 --- a/tests/FakeEventRepositoryTest.php +++ b/tests/FakeEventRepositoryTest.php @@ -2,13 +2,16 @@ namespace App\Tests; +use App\EventRepository; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; final class FakeEventRepositoryTest extends KernelTestCase { /** @test */ public function should_only_return_attendees_with_a_yes_rsvp(): void { - $repository = new FakeEventRepository(); + $container = self::bootKernel()->getContainer(); + $repository = $container->get(EventRepository::class); + $attendees = $repository->getConfirmedAttendees(); $this->assertCount(3, $attendees->pluck('name'));