0

I'm trying to use Codeception with Symfony 4 but I'm not able to grab services within tests ( Unit or Funcional )

I have enable the configuration in test yml file, I have tried to gram services but nothing work.

Can someone tell me what I'm doing wrong?

actor: UnitTester
modules:
    enabled:
        - \Helper\Unit
        - Symfony:
            app_path: 'src'
            environment: 'dev'

How can I get a services in my test using Symfony Service Container?

I tried with

$container = $this->getModule('Symfony')->container;

But it does not work. Any idea?

Thanks in advance

1 Answer 1

1

Symfony module has not container property since Codeception 2.1.8, call _getContainer method instead.

$container = $this->getModule('Symfony')->_getContainer();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.