Commit Graph

42 Commits

Author SHA1 Message Date
Jeremy Mikola
b29c423fda PHPC-1057: Refactor option parsing for execute methods
Execute options are now parsed via php_array functions, which makes the options case-sensitive.

A helper function is now used to convert legacy options for the original three execute methods into an array. This simplifies option parsing in php_phongo.c.

Additionally, Manager methods now perform their own server selection, which means that execute functions in php_phongo.c can rely on a server_id being provided.

Tests have been updated to expect a serverId option when relevant (e.g. query opts). Additionally, error tests for execute methods have been improved so that invalid values for all known options are tested.
2017-12-18 12:11:57 -05:00
Jeremy Mikola
ecaeb2c1a2 Replace tabs with spaces in test files 2017-12-12 08:17:59 -05:00
Derick Rethans
68bb32c6f7 PHPC-904: ReadPreference constructor should accept strings 2017-04-04 16:55:49 +01:00
Jeremy Mikola
21172ea914 mongoc_cursor_is_alive() now returns false when cursors have no results 2017-03-28 18:35:35 -04:00
Jeremy Mikola
e6b8479506 Reorganize SKIPIF blocks in tests and add missing NEEDS() checks 2017-03-15 10:41:04 -04:00
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
a267e05eb8 Comprehensive tests for RC, RP, and WC debug output and BSON serialization 2016-09-26 10:53:21 -04:00
Jeremy Mikola
6d46d62577 PHPC-359: Ensure RP tag sets serialize as documents 2016-09-26 10:53:21 -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
Jeremy Mikola
77209dd65d PHPC-752: Add maxStalenessMS to ReadPreference class
This adds an options array to the ReadPreference constructor, which accepts a maxStalenessMS option. The option is also exposed via a getter method and in debug output.
2016-09-19 16:54:48 -04:00
Jeremy Mikola
40a0f52cc0 Use short array syntax in ReadPreference tests 2016-09-19 16:54:48 -04:00
Jeremy Mikola
d9b6613562 Remove unnecessary SKIPIFs from ReadPreference tests 2016-09-19 16:54:48 -04:00
Jeremy Mikola
11d823f8cd PHPC-498: Fix expected output for ReadPreference and WriteConcern
These test fixes were missed in mongodb/mongo-php-driver#413.
2016-09-19 16:52:38 -04:00
Derick Rethans
8f9e6c8c53 PHPC-498: ReadPreference, ReadConcern, and WriteConcern should serialize to BSON 2016-09-19 20:33:14 +01:00
Jeremy Mikola
5568225fcd Fix test name for ReadPreference::getTagSets() 2016-09-15 12:41:17 -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
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
2fa57d7d05 Regression test for extending final classes 2016-02-09 15:25: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
Hannes Magnusson
4d6157fb78 $readPreferences should not be sent to standalone server 2015-10-01 15:22:06 -04:00
Jeremy Mikola
686503f3e9 Revise ReadPreference constructor error messages 2015-09-16 17:37:14 -04:00
Jeremy Mikola
27ee04ff88 PHPC-418: Getters for ReadPreference properties 2015-09-16 17:37:13 -04:00
Jeremy Mikola
f5a0a534aa Use valid tag sets in ReadPreference tests 2015-09-16 17:37:13 -04:00
Jeremy Mikola
f561cf5f8e Rename ReadPreference tests and split constructor error test 2015-09-16 17:37:13 -04:00
Jeremy Mikola
6eb0944565 PHPC-319: Convert top-level documents to stdClass by default
Update tests to expect stdClass for documents. Debug handlers and the Server getter methods will still decode documents as native arrays.
2015-07-11 00:38:05 -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
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
227e7842cb Use absolute paths in skipifs too 2015-03-25 14:08:39 -07: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
5f8d990b53 PHPC-24 PHPC-77 PHPC-69 Provide a functioning Server object 2015-03-20 11:33:46 -07:00
Hannes Magnusson
3efb11c140 PHPC-180: Rename constant and pass the cleanup uri explicitly
- Use the new connection string constant that includes auth
- Call the cleanup routines explicitly when needed
2015-03-16 20:30:15 -07:00
Hannes Magnusson
4acca269c2 This is a Manager, not MongoClient 2015-02-19 13:59:50 -08:00
Hannes Magnusson
a9823e706f Ignore me. Trim trailing space
This has been annoying me for a long time, especially the '<?php '
2015-02-19 13:57:58 -08:00
Hannes Magnusson
9e4277e402 PHPC-157: QueryResult and CommandResult are now Result 2015-02-18 11:00:07 -08:00
Hannes Magnusson
557ed02006 PHPC-146: ReadPreferences swapped 2015-01-28 13:46:22 -08:00
Hannes Magnusson
4a20c63e1c PHPC-138: var_dump()ing ReadPreference 2015-01-27 11:55:43 -08:00
Hannes Magnusson
bb5f45c313 PHPC-118: Use MongoDB\Driver namespace for phongo 2014-12-30 14:58:33 -08:00
Hannes Magnusson
19cfa46ee1 new tests 2014-07-21 22:07:48 +00:00