218 Commits

Author SHA1 Message Date
Jeremy Mikola f0cc9c2376 PHPC-282: Test for multiple Cursor::toArray() calls 2015-05-04 17:56:10 -04:00
Jeremy Mikola 04d589b5b6 PHPC-255: Cursors cannot rewind after starting iteration 2015-05-04 17:05:25 -04:00
Jeremy Mikola 95d1ed8e73 PHPC-282: Remove tests for multiple iterators on the same Cursor 2015-05-04 16:21:06 -04:00
Jeremy Mikola 4e7df722dd PHPC-282: Cursor should not yield multiple iterators
Successive get_iterator handler invocations should throw a LogicException. This avoids situations that might allow the user to iterate over the same cursor multiple times.
2015-05-04 16:15:17 -04:00
Jeremy Mikola 0b987982fa PHPC-283: UnexpectedValueException for invalid bsonSerialize() return value 2015-05-04 14:34:01 -04:00
Jeremy Mikola 998c85bfba PHPC-179: Show unset journal/fsync as null in WriteConcern debug handler 2015-05-04 14:24:37 -04:00
Jeremy Mikola 56e55670b4 PHPC-274: Regression test for root BSON\Serializable encoding 2015-05-04 14:23:44 -04:00
Jeremy Mikola 047bea5705 PHPC-275: object_to_bson() handling for invalid bsonSerialize() retval
This also refactors the handling to be consistent with zval_to_bson().
2015-05-04 14:23:44 -04:00
Jeremy Mikola 9e59cee9d0 PHPC-274: Fix zval_to_bson() encoding of BSON\Serializable objects
Previously, only BSON\Persistable objects were handled.
2015-05-04 14:23:44 -04:00
Hannes Magnusson 68eba44df5 PHPC-272: Move exceptions into MongoDB\Driver\Exception namespace 2015-04-24 15:40:28 -07:00
Hannes Magnusson 60fdf52e1d PHPC-241: mongodb.debug improvements 2015-04-24 11:51:09 -07:00
Hannes Magnusson ca04dd6d2c PHPC-270: Several test fail because of missing enableTestCommands 2015-04-23 19:56:37 -07:00
Hannes Magnusson 8364cd4d77 PHPC-270: add TESTCOMMANDS() skipif to confirm mongod is running with required options 2015-04-23 19:56:37 -07:00
Hannes Magnusson 536ec40a9e PHPC-268: Update tests to declare which environments they need 2015-04-23 19:56:37 -07:00
Hannes Magnusson 499bae18b4 PHPC-268: Add NEEDS() function to check if that environment is available 2015-04-23 19:22:14 -07:00
Hannes Magnusson 122d1fd7a7 Object IDs change, fix test 2015-04-23 19:22:14 -07:00
Hannes Magnusson d2eb4c8634 PHPC-247: Remove on-the-fly composer generated fixtures 2015-04-23 16:13:36 -07:00
Hannes Magnusson ec91b77e46 PHPC-247: Use the bundled pregenerated fixtures 2015-04-23 16:13:36 -07:00
Hannes Magnusson a52b7750ea PHPC-89: Bundle generated fixtures and make them easily loadable 2015-04-23 16:13:36 -07:00
Hannes Magnusson fa1a263cc4 PHPC-260: Allow/use "object" in setTypeMap() as alias/preferred for "stdclass" 2015-04-23 16:13:35 -07:00
Hannes Magnusson f1d053a767 PHPC-267; _id generated on embedded document 2015-04-23 16:13:35 -07:00
Hannes Magnusson d64698a60a PHPC-265: BSON encoding unsupoprted types (Resource) should fail 2015-04-23 16:13:35 -07:00
Hannes Magnusson c865d56f93 PHPC-75: Improve code coverage 2015-04-23 10:16:20 -07:00
Hannes Magnusson 6e31d2f116 Fix tests on 5.3 -- and use consistent db/collection 2015-04-21 13:53:47 -07:00
Hannes Magnusson 41e0323f25 Fix test - set my favorite ini option: date.timezone 2015-04-21 13:30:03 -07:00
Hannes Magnusson c4e57d299e Fix tests 2015-04-21 13:24:21 -07:00
Jeremy Mikola f176cb7d91 Test Cursor iteration handlers and ensure rewind doesn't reset position 2015-04-21 14:23:16 -04:00
Jeremy Mikola 80e6951028 Tests for multiple iterators sharing the same Cursor 2015-04-21 14:23:16 -04:00
Jeremy Mikola c7b7891697 PHPC-240: Rely on libmongoc for command cursor iteration
libmongoc already provides a mechanism to upgrade a cursor with a single command result document into a command cursor, which will seamlessly iterate through the first batch and documents returned by successive getmore ops.

This allows us to remove our own "first batch" handling and simplify the move_forward and rewind iteration handlers.
2015-04-21 14:23:16 -04:00
Jeremy Mikola cb3e96d961 PHPC-240: Regression tests for command cursor getmore 2015-04-21 14:23:16 -04:00
Hannes Magnusson 0afcb348dd PHPC-249: empty array should be serialized as array 2015-04-16 13:46:58 -07:00
Hannes Magnusson c162c29215 PHPC-248: Allow ->setTypeMap() to set 'array' and 'stdclass' 2015-04-16 13:21:58 -07:00
Hannes Magnusson e147fd3f7f PHPC-245: executeUpdate() converts objects to arrays
Multiple things here -- we shouldn't be injecting __pclass every time
we serialize an object -- only when we are preparing it to be inserted.
Otherwise, for example when executing an update, it will be injected
into the update document too -- which b0rks the update statement.

We also need to bail out when we don't get an array from the serialize
callback -- and rather then pretend the return array from the callback
is the data we got passed in in the get-go, keep the original zval
intact so we don't accidentally convert it to array
2015-04-15 11:27:19 -07:00
Hannes Magnusson 2154934938 PHPC-244: Cannot use object of type Person as array 2015-04-14 20:00:37 -07:00
Hannes Magnusson f4de8a4249 PHPC-243: Manager->executeUpdate() option is supposed to be 'multi' 2015-04-14 15:15:35 -07:00
Hannes Magnusson 251ed3ef39 PHPC-239: Cursor refcount issues
This also fixes re-iterating over a cursor where we would not free the
firstBatch properly, so the last result was still there.
2015-04-14 11:45:33 -07:00
Hannes Magnusson 815876050f Fix path to tests when executed through pecl run-tests 2015-04-08 15:45:20 -07:00
Hannes Magnusson 73a510d946 Workaround CDRIVER-610 2015-04-08 14:42:56 -07:00
Hannes Magnusson 0ea1c5e863 PHPC-231: Manager instances should not free streams that are still in use 2015-04-08 12:58:05 -07:00
Jeremy Mikola 32bdb2b2ed PHPC-231: Regression test for Manager destruct stream freeing 2015-04-07 15:06:36 -04:00
Jeremy Mikola c454d27d95 PHPC-215: Fix Cursor iteration through IteratorIterator
This removes the invalidate_current handler. Due to SPL's implementation, our handler was being invoked between rewinding and checking if the current position was valid. Given that our validity check depends on inspecting a pointer to the current element (like MySQLi's result iterator), we cannot use invalidate_current.

The current element must still be freed during iteration, so we will instead call a php_phongo_cursor_free_current() function as needed. Additionally, we should track a reference to the Cursor object zval on the iterator itself, which will ensure it is not garbage-collected during iteration (demonstrated in the segfault backtrace in PHPC-215).

Lastly, this commit renames the Cursor object and iterator structs and related functions to be more consistent with implementions in PHP core.
2015-04-06 15:45:19 -04:00
Jeremy Mikola e2e9d89cb2 PHPC-225: Test Cursor::isDead() and kill on destruct
Testing for kill on destruct is based on PyMongo (see: https://jira.mongodb.org/browse/SERVER-5816?focusedCommentId=201245).
2015-04-06 15:45:19 -04:00
Jeremy Mikola 66193e83bc PHPC-224: Consolidate Result and Cursor classes into one
This class is now simply Traversable (no longer IteratorAggregate) and adds isDead() and getId() methods from the original Cursor class.
2015-04-06 15:45:19 -04:00
Hannes Magnusson 81de2ca8ff PHPC-210 & PHPC-209 & PHPC-207 Fix BSON ODM/ODS 2015-04-03 16:06:46 -07:00
Hannes Magnusson 86d3a8f798 PHPC-208: Restrict ODS to "__pclass" fieldnames 2015-04-03 15:17:59 -07:00
Hannes Magnusson 848acb01ba PHPC-194: Implement Manager::selectServer() method to wrap SDAM server selection 2015-04-03 14:29:05 -07:00
Hannes Magnusson b3b3322cb4 In PHP5.3 we hit the __wakeUp() which has slightly different exception 2015-04-03 13:44:53 -07:00
Hannes Magnusson ee9e33148a PHPC-223: Use explicit SSL options rather then stream context
This also adds support for PHPC-185
2015-04-02 16:15:22 -07:00
Hannes Magnusson 015aa02d12 Cleanup after test 2015-04-02 09:44:17 -07:00
Hannes Magnusson 9a75c1785e Make it possible to cleanup other db and collections used 2015-04-02 09:40:37 -07:00