user2930232
user2930232

Reputation: 31

Codeception: How do I get access to Symfony services from functional tests?

Using Codeception with Symfony2. Calling grabServiceFromContainer('doctrine') from a functional TestGuy returns a very empty Codeception\Maybe object, not the expected service.

How do you get access to Symfony services from the functional test? Is it not possible? You can from the unit TestGuy - why not from the functional TestGuy? Do I have to fetch the module first?

Upvotes: 3

Views: 994

Answers (1)

Tom
Tom

Reputation: 2873

It works for me with this functional.suite.yml config:

class_name: TestGuy
modules:
    enabled: [Symfony2, Doctrine2, TestHelper]
    config:
        Symfony2:
            app_path:   'app'
            environment:    'test'

make sure you run the "build" command after changing the config, maybe that is the problem?

Upvotes: 2

Related Questions