Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 604
user2930232 Avatar asked Dec 06 '25 03:12

user2930232


1 Answers

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?

like image 199
Tom Avatar answered Dec 09 '25 20:12

Tom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!