S
S
sl1m_dogg2016-03-27 13:01:49
symfony
sl1m_dogg, 2016-03-27 13:01:49

How to load a service from a container in Symfony 2.7, PHPUnit?

There is a registered service in the container, you need to load this service in the test. Question number 2: how to test sending a swiftmailer, i.e. you need to write a mock for this mailer, I saw one option using a guzzle, but I didn’t understand something, how to do it all the same?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2016-03-31
@prototype_denis

1) $client = static::createClient(); $client->getContainer()->get('foo');
2) symfony.com/doc/current/cookbook/email/testing.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question