PHPUnit testing class without constructor

0

I'm developing unit tests on a project and I came across a class that does not contain constructor.

You may wonder, "How does this object exist then?"

Well, in another system, this object is generated and saved in a database, so in the system where unit tests are required, there is no constructor defined for this class. But there is a need to test their functions so that if they are modified in the system in the future, the tests will acknowledge in which situations they are used, and do not neglect due attention to the other points of the project that use it.

Within this environment, how can you test this type of class?

I tried to use mocks, but mock brings all the null attributes. In addition, a "mokado" object only comes as a result of a function of you, what you say it will bring. Soon to test the functions of the object itself, this is not functional.

Any ideas?

    
asked by anonymous 20.04.2018 / 21:49

0 answers