195 Commits

Author SHA1 Message Date
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
Hannes Magnusson 9817e6877e Fix tests when executed outside of srcroot
Fixes running tests with pecl run-tests -p mongodb and on windows
2015-04-01 16:34:56 -07:00
Hannes Magnusson 047de42087 PHPC-220: BSON\UTCDatetime broken on 32bit 2015-04-01 16:16:33 -07:00
Jeremy Mikola cf0c882a98 PHPC-204: Result::toArray() should respect type map configuration 2015-03-31 19:29:57 -04:00
Jeremy Mikola 5cefd644b9 PHPC-203: Result::toArray() should proxy iterator_to_array($this)
This introduces a BC break in that toArray() no longer returns the first result document. It must now be manually unwrapped from the return value.
2015-03-31 19:29:57 -04:00
Hannes Magnusson 02886670b2 PHPC-216: Use array(), not [], for PHP5.3 compatibility 2015-03-30 17:02:34 -07:00
Hannes Magnusson 099c344f72 PHPC-216: PHP5.3 test suite fixes 2015-03-30 15:55:05 -07:00
Hannes Magnusson 5dffbe2ac7 PHPC-216: PHP5.3 test suite fixes 2015-03-30 13:30:53 -07:00
Hannes Magnusson 382970a9d1 Merge pull request #28 from jmikola/phpc-201
PHPC-201: Rename Result::setTypemap() to setTypeMap()
2015-03-25 20:50:34 -07:00
Hannes Magnusson 227e7842cb Use absolute paths in skipifs too 2015-03-25 14:08:39 -07:00
Jeremy Mikola afafb14c87 PHPC-201: Rename Result::setTypemap() to setTypeMap() 2015-03-25 16:58:10 -04:00
Hannes Magnusson 1cce49d21c Use absolute paths on in tests so they can run easier on windows 2015-03-25 13:32:09 -07:00
Hannes Magnusson 71f29b47a1 Absolute path is required to run tests on windows 2015-03-25 13:22:46 -07:00
Hannes Magnusson 4a274d319f Improve code coverage 2015-03-24 09:31:50 -07:00
Hannes Magnusson c6a793d466 Add raises() helper, similar to throws() except for php warnings/notices/deprecated/... 2015-03-24 09:31:50 -07:00
Hannes Magnusson 809e99d7b8 PHPC-174: Rename module registration, constants and so on to mongodb 2015-03-23 16:37:38 -07:00
Hannes Magnusson bb02c4861b Test for PHPC-186 2015-03-23 13:53:33 -07:00
Hannes Magnusson 8b1624b282 PHPC-189: Implement Manager->getServers() 2015-03-20 15:02:57 -07:00
Hannes Magnusson 4da65af278 PHPC-188: Populate MongoDB\Driver\Server 2015-03-20 14:14:35 -07:00
Hannes Magnusson 5f8d990b53 PHPC-24 PHPC-77 PHPC-69 Provide a functioning Server object 2015-03-20 11:33:46 -07:00
Hannes Magnusson 3bb0c8b6cb In SDAM this is forbidden and throws exception 2015-03-19 14:20:44 -07:00
Hannes Magnusson 9d78b52287 Show the response when the test fails 2015-03-19 14:20:44 -07:00
Hannes Magnusson dd16db9d50 PHPC-180: Fix limited batch import
Also fixed cache mtime debug check :)
2015-03-16 22:49:44 -07:00
Hannes Magnusson b32ebba8a2 PHPC-180: No need to sleep anything, we get a fresh connection in next test 2015-03-16 22:37:16 -07:00