I am using PHPUnit to test my code. Just to experiment with Phalcon, I have a basic model where I'm setting default values in the initialize method. I have one unit test that ensures these default values are set, and another test to put stuff in the database and test that it's there.
The first test works fine and the second test fails because none of these default values aren't set. If I comment out the first test (which doesn't touch the db) the default values are set and the second test passes. I have no idea why!
My unit test is extending a custom implementation of the incubator's
ModelTestCase and in the set up I prepare the DI, set the database and begin a transaction. In the teardown, I rollback the transaction and call the PHPUnit\Framework\TestCase::tearDown() directly.
I've discovered that in the second unit test, the
initialize method isn't called. Is this a special method that's only called once per 'application run'? Should I not be setting default values there?