Today I came back to a project I have not touched for a while. It is a Zend Framework 2 project using MongoDB as its database.
I decided since it had been a while to update MongoDB to the latest version (2.4) from (2.0), and the driver to the latest (1.4.2?).
Now when running my PHPUnit tests I get errors due to a mocked MongoCollection class failing a "is_a()" test.
Instead of the new mocked class being an instance of MongoCollection, it turns out to be a _PHP_Incomplete_Class instance instead. I have been searching high and low and I cannot find anyone with the same issue. I can only assume something has changed to the MongoDB classes that PHPUnit doesn't like.
$collection = $this->getMockBuilder('MongoCollection')
->disableOriginalConstructor()
->getMock();
When inspecting $collection I see:
_PHP_Incomplete_Class Object {
_PHP_Incomplete_Class_Name => (string) Mock_MongoCollection_2798b1f7"
}
Does anyone know a way around this or do I need to bash out my own MongoCollection mock/test class to test with?