测试中的Symfony3.4服务容器

Test code:

$manager = $this->getMockBuilder('ApiClientManager')
        ->setMethods(array('createClient'))
        ->getMock();

$this->_client->getContainer()->set('api.manager', $manager);

services.yml

services:
    api.manager:
    public: true

I get a warning

The "api.manager" service is already initialized, replacing it is deprecated since Symfony 3.3 and will fail in 4.0.

I want to improve this problem, how to modify it?

If you change 'services.yml' to

services:
    api.manager:
    public: false

I get a warning

The "api.manager" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0.

How to optimize this problem?