chriskite / phactory

A Database Factory for PHP Unit Tests
http://phactory.org
MIT License
140 stars 39 forks source link

Should Use Safe Insert in Mongo #20

Open jbourdin opened 12 years ago

jbourdin commented 12 years ago

Since for testing purpose we check phactory writen data in mongo with our own code readden data, we are exposed to race condition. It happens that Phactory::create use MongoCollection->insert and that '$collection->insert' don't wait for mongod response and our PHP test go on even if the data status is not what we expect. It happens for example on a slow development environnement.

I think Phactory::create should invoke collection->insert with array('safe'=>true) as second argument.

jimbojsb commented 12 years ago

Agree, if you submit a pull request, I will merge it.

jbourdin commented 12 years ago

Working on it. But I just discovered that the Pear version, the one I use, seems way behind this one. I must take a few moments to update my test cases

jimbojsb commented 12 years ago

We haven't release the massive namespaces update on the pear channel yet, but I tagged it today, so it should appear on pearhub imminently.

On Aug 21, 2012, at 5:39 PM, Julien Bourdin notifications@github.com wrote:

Working on it. But I just discovered that the Pear version, the one I use, seems way behind this one. I must take a few moments to update my test cases

— Reply to this email directly or view it on GitHub.