We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Service not found in dependency injection container when I run unit tests

Hey guys,

When I try to run my unit tests I have this error:

Phalcon\DI\Exception: Service 'collectionManager' was not found in the dependency injection container

The error occurs on method initialize of my \Phalcon\Mvc\Collection when I instantiate the object. Here's the code of my initialize method:

public function initialize()

{

$this->setConnectionService('MongoDB');    

}

Anyone knows how to solve that?

edited Apr '14

Hi I think you might want to look at this post.

configure mongo db properly

)

edited Apr '14

I already did that and I still have the error.

I'm using configuration available on phalcon docs: https://docs.phalcon.io/en/latest/reference/unit-testing.html