Hi guys -
I'm having some difficulty getting my unit tests (set up the way in the docs) to share the DI services I define in my application. All of my application libraries & components extend the \Phalcon\Mvc\User\Component class and allow me to call services like $this->session->get('var') from within my app libraries. $this->session in this case is a service shared on the dependency injector and defined in /app/config/services.php.
What I want to do is use the same services in my unit tests that my application uses. To do that I've included the same files in my /tests/bootstrap.php file that I did in my /public/index.php file. The problem I'm having is that my application libraries are throwing an error on calls like $this->session because it's not recognizing the service.
However, if I change my app libraries to do this:
$session = \Phalcon\DI::getDefault()->getSession(); $session->get( 'var' );
it works okay.
Is there any way I can maintain the $this->session syntax in my app libraries after bootstrapping the same services in my unit tests? I (a) don't want to redefine the services in my unit tests, and (b) don't want to muddy my app library code with a ton of DI::getDefault()->getService() calls.
I appreciate any help you guys can offer!