72 Commits

Author SHA1 Message Date
Jeremy Mikola 120b270377 PHPC-851: Separate argument zvals before modification
This primarily fixes a bug introduced in 6d46d62577 for PHPC-359, since we convert tag sets from arrays to objects to ensure proper BSON serialization. Not only was the array mutation visible to calling contexts, but a crash could occur if the array was immutable due to OPcache.

For Manager's $driverOptions, a comment in 1060cb8ba4 for PHPC-433 indicated that we should have separated its zval due to possible modification, but the appropriate zend_parse_parameters() flag was never used.
2016-12-12 19:31:45 -05:00
Derick Rethans 43b06f0ca3 PHPC-827: Update Max Staleness implementation 2016-11-28 11:32:01 +00:00
Jeremy Mikola 6dc41c409f PHPC-676: Do not allow BulkWrite objects to be executed multiple times 2016-11-22 11:10:02 -05:00
Jeremy Mikola 6d46d62577 PHPC-359: Ensure RP tag sets serialize as documents 2016-09-26 10:53:21 -04:00
Jeremy Mikola 1fabf41a57 Fix Manager extends test, which previously duplicated Query 2016-09-21 16:32:39 -04:00
Jeremy Mikola f37f589bbc PHPC-783: Use mongoc_collection_find_with_opts() for Query exec
Query struct fields have been consolidated to a filter and opts BSON documents.

This also changes the Query debug output significantly.
2016-09-20 16:57:20 -04:00
Derick Rethans 53dec68a77 Disable test for HHVM, as we don't have logging for this 2016-09-20 15:00:36 +01:00
Jeremy Mikola 6ec5348957 Test that read preference options of the wrong type are ignored 2016-09-19 16:54:48 -04:00
Jeremy Mikola 0160871af6 PHPC-752: Validate range of maxStalenessMS Manager option
This also adds various tests for parsing of read preference Manager options.
2016-09-19 16:54:48 -04:00
Jeremy Mikola eeb7c04d04 Remove unnecessary SKIPIFs from Manager ctor tests 2016-09-19 16:54:48 -04:00
Jeremy Mikola 701e07f9e5 Rename Manager ctor read preference and write concern tests 2016-09-19 16:54:48 -04:00
Derick Rethans 8f9e6c8c53 PHPC-498: ReadPreference, ReadConcern, and WriteConcern should serialize to BSON 2016-09-19 20:33:14 +01:00
Derick Rethans 027384feed PHPC-786: Tests for appname URI option 2016-09-19 12:07:11 -04:00
Jeremy Mikola 56d8b77b15 PHPC-424: Validate that RP tag set is an array of documents
This adds common validation for read preference tag sets when specified through either the Manager constructor's URI options array or ReadPreference constructor.

An additional test case for a malformed tag set has been added to the Manager::__construct() error test for read preference options. Additionally, the ReadPreference::__construct() error test has been split up to test for mode and tagSet errors separately.

Note: we cannot test for the exceptions for bson_init_static() and mongoc_read_prefs_is_valid(), since those points will never be hit in normal operation.
2016-09-15 12:40:27 -04:00
Jeremy Mikola 29e5121cb7 PHPC-433: Persist mongoc_client_t objects in a HashTable
Clients will be hashed by Manager constructor arguments. Since they must persist between requests, the Manager destructor will no longer free the client and we'll need to start using persistent memory allocation for libbson and libmongoc.
2016-09-08 11:10:34 -04:00
Jeremy Mikola c673e0aee2 PHPC-704: Do not set mongodb.debug from driver options
The mongodb.debug INI option is a global setting and should not be set based on a single Manager's constructor argument.
2016-09-07 18:08:19 -04:00
Derick Rethans 0ab5d5c74c PHPC-752: Allow users to set a limit on acceptable staleness 2016-08-31 14:41:58 -04:00
Derick Rethans f7b8905085 Debugging through mongodb.debug no longer works 2016-08-31 18:11:53 +01:00
Derick Rethans 39044213f3 Fixed tests, as MongoDB 3.3 adds an extra item 2016-08-31 18:11:53 +01:00
Jeremy Mikola ae6016e7ba PHPC-605: Revise tests for libmongoc socket handling
Expected output changes now that PHP streams are no longer used for socket IO.
2016-08-30 14:04:56 -04:00
Jeremy Mikola 7f485f921e PHPC-761: Tests can rely on MongoDB\BSON namespace 2016-08-05 14:06:58 -04:00
Jeremy Mikola 5fbcef0638 PHPC-746: Default Manager URI to "mongodb://127.0.0.1/" 2016-07-15 11:14:45 -04:00
Jeremy Mikola 4e26b503bd Declare __wakeup as lowercase for consistency 2016-07-15 11:11:48 -04:00
Jeremy Mikola a327a22cb8 Merge branch 'v1.1' 2016-06-02 11:20:03 -04:00
Jeremy Mikola 3b06e81f9a PHPC-572: Keep stream context options alive for Manager's lifetime 2016-06-01 22:54:08 -04:00
Jeremy Mikola c0046a3e63 PHPC-673: Fix Cursor::isDead() tests for mongoc_cursor_is_alive()
This changes our tests based on upstream fixes for mongoc_cursor_is_alive() in CDRIVER-1221.
2016-05-17 16:12:13 -04:00
Jeremy Mikola 78839bde83 PHPC-688: Change Cursor debug handler to use libmongoc public API
This significantly alters the structure of the Cursor's debug output, since we not longer have access to private fields within mongoc_cursor_t.
2016-05-06 11:48:31 -04:00
Jeremy Mikola acc06c176d Update expected error message for server selection failures
This message was changed in https://github.com/mongodb/mongo-c-driver/commit/ed4d53ec873952ac929bc3f4467a935dde2a0681 for CDRIVER-1203.
2016-05-03 13:03:51 -04:00
Jeremy Mikola ae801ee37f PHPC-600: Use mongoc_client_get_server_descriptions() to get Manager's Servers 2016-04-12 15:29:41 -04:00
Jeremy Mikola d1079cfabb PHPC-564, PHPC-626: WriteResult should use libmongoc's public API
This changes WriteResult to encapsulate a bson_t, which is populated by mongoc_bulk_operation_execute(), instead of the private mongoc_write_result_t struct. This entailed significant changes to the WriteResult debug handler, so new tests have been added for it.

With phongo_execute_write() modified to populate a bson_t reply, we also changed error handling to pull a BulkWriteException message from bson_error_t (PHPC-626). That change required several error tests to be modified for the new message format.
2016-03-21 11:42:28 -04:00
Derick Rethans 5c366ee5b4 Fixed PHPC-506: Use more descriptive messages in WriteExceptions 2016-03-01 14:07:54 +00:00
Jeremy Mikola 016eaf8aa0 PHPC-581: Use ConnectionTimeoutException for server selection failures 2016-02-15 12:41:28 -05:00
Jeremy Mikola a287ded536 PHPC-553: Relax expected output patterns for HHVM 2016-02-15 12:36:51 -05:00
Jeremy Mikola cca7d04fef PHPC-553: Suppress warnings during stream creation
This allows PHP's warnings during connection initialization (e.g. unresolvable host names) to be captured into the bson_error_t, which is later used to throw an exception.
2016-02-15 12:36:51 -05:00
Jeremy Mikola 2930c348db PHPC-566: Remove request_id from Manager::__debugInfo() 2016-02-15 12:09:17 -05:00
Jeremy Mikola d9674b5bd0 PHPC-523: Parse readconcernlevel in URI options array 2016-02-11 17:21:18 -05:00
Jeremy Mikola 2fa57d7d05 Regression test for extending final classes 2016-02-09 15:25:14 -05:00
Jeremy Mikola 9d04bcd69c PHPC-509: Default Manager URI to "mongodb://localhost:27017/" 2015-12-14 18:01:31 -05:00
Jeremy Mikola 90d438e626 PHPC-448: Manager::getReadConcern() and URI test 2015-12-11 15:22:55 -05:00
Jeremy Mikola bea901d170 PHPC-443: Support "bypassDocumentValidation" option in BulkWrite 2015-12-11 13:43:14 -05:00
Jeremy Mikola b54a8bf05b PHPC-450: Split query tests for OP_QUERY and find command
This also entails a change to done/end_of_event cursor field assertions. These are internal libmongoc cursor fields and their values aren't relevant to the tests. In the future, we may consider removing them from the Cursor's dump output.
2015-12-10 12:16:36 -05:00
Hannes Magnusson 49225e1dc7 PHPC-495: Upgrade bundled libbson and libmongoc to 1.3.0 2015-12-02 18:11:46 +00:00
Jeremy Mikola fe9fb63267 PHPC-465: Remove Manager's single write methods
Existing tests for single write methods were ported to executeBulkWrite() tests.
2015-10-21 19:32:42 -04:00
Jeremy Mikola 52dfd6b2d2 PHPC-444: Support options array in BulkWrite and executeInsert() 2015-10-15 15:44:17 -04:00
Remi Collet aeb2bc4669 PHPC-442: report PHP version in debug info 2015-10-05 17:28:23 -04:00
Remi Collet efde19a1de report runtime version in debug mode 2015-10-05 17:28:23 -04:00
Jeremy Mikola 31661a383d Test write and WC error extraction for single write methods 2015-10-05 16:15:10 -04:00
Jeremy Mikola dcbf5ae6ba PHPC-428: Remove support for WriteConcern fsync option 2015-09-23 11:47:53 -04:00
Jeremy Mikola a6932d59e0 PHPC-423: WriteConcern should report default "w" option as null 2015-09-22 14:07:23 -04:00
Derick Rethans 73ab90eb4d Skip logging tests for HHVM, which will use its own method 2015-09-22 11:02:03 -04:00