C
C
camradee2018-07-23 15:09:57
PHPUnit
camradee, 2018-07-23 15:09:57

Why doesn't the PHPUnit test in Phalcon see the service properties of the instance of the class under test?

I set up phpunit according to the official manual. The basic example test works. Then I changed the settings a little according to this example: https://github.com/SavvySoftWorksLLC/phalcon_3_2_d...
I did this to connect the project's configs and services. The difference with the code from the git is that instead of testBoringLibrary in BasicTest.php I have the testValidator method, where the first line is $res = new FormValidator(); and the test throws an Access to undefined property request error, because the FormValidator has a $this->request service, and another service $this->translate is used there (prepares error messages in form fields); these services, like others, are connected in app/config/services.php but the code does not see them.
I connect PHPUnit to Phalcon for the first time, I haven’t googled a single real example of the test config, what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question