Skip to content

Commit 150f110

Browse files
committed
Merge pull request #487
2 parents 70f8c0a + 0a3b2b7 commit 150f110

File tree

3 files changed

+0
-94
lines changed

3 files changed

+0
-94
lines changed

src/functions.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -165,25 +165,6 @@ function is_mapreduce_output_inline($out)
165165
return key($out) === 'inline';
166166
}
167167

168-
/**
169-
* Converts a ReadConcern instance to a stdClass for use in a BSON document.
170-
*
171-
* @internal
172-
* @see https://jira.mongodb.org/browse/PHPC-498
173-
* @param ReadConcern $readConcern Read concern
174-
* @return stdClass
175-
*/
176-
function read_concern_as_document(ReadConcern $readConcern)
177-
{
178-
$document = [];
179-
180-
if ($readConcern->getLevel() !== null) {
181-
$document['level'] = $readConcern->getLevel();
182-
}
183-
184-
return (object) $document;
185-
}
186-
187168
/**
188169
* Return whether the server supports a particular feature.
189170
*
@@ -213,29 +194,3 @@ function is_string_array($input) {
213194
return true;
214195
}
215196

216-
/**
217-
* Converts a WriteConcern instance to a stdClass for use in a BSON document.
218-
*
219-
* @internal
220-
* @see https://jira.mongodb.org/browse/PHPC-498
221-
* @param WriteConcern $writeConcern Write concern
222-
* @return stdClass
223-
*/
224-
function write_concern_as_document(WriteConcern $writeConcern)
225-
{
226-
$document = [];
227-
228-
if ($writeConcern->getW() !== null) {
229-
$document['w'] = $writeConcern->getW();
230-
}
231-
232-
if ($writeConcern->getJournal() !== null) {
233-
$document['j'] = $writeConcern->getJournal();
234-
}
235-
236-
if ($writeConcern->getWtimeout() !== 0) {
237-
$document['wtimeout'] = $writeConcern->getWtimeout();
238-
}
239-
240-
return (object) $document;
241-
}

tests/ClientTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ public function testToString()
4848

4949
public function testSelectCollectionInheritsOptions()
5050
{
51-
$this->markTestSkipped('Depends on https://jira.mongodb.org/browse/PHPC-523');
52-
5351
$uriOptions = [
5452
'readConcernLevel' => ReadConcern::LOCAL,
5553
'readPreference' => 'secondaryPreferred',
@@ -112,8 +110,6 @@ public function testGetSelectsDatabaseAndInheritsOptions()
112110

113111
public function testSelectDatabaseInheritsOptions()
114112
{
115-
$this->markTestSkipped('Depends on https://jira.mongodb.org/browse/PHPC-523');
116-
117113
$uriOptions = [
118114
'readConcernLevel' => ReadConcern::LOCAL,
119115
'readPreference' => 'secondaryPreferred',

tests/FunctionsTest.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -134,49 +134,4 @@ public function provideMapReduceOutValues()
134134
[ ['replace' => 'collectionName'], false ],
135135
];
136136
}
137-
138-
/**
139-
* @dataProvider provideReadConcernsAndDocuments
140-
*/
141-
public function testReadConcernAsDocument(ReadConcern $readConcern, $expectedDocument)
142-
{
143-
$this->assertEquals($expectedDocument, \MongoDB\read_concern_as_document($readConcern));
144-
}
145-
146-
public function provideReadConcernsAndDocuments()
147-
{
148-
return [
149-
[ new ReadConcern, (object) [] ],
150-
[ new ReadConcern(ReadConcern::LOCAL), (object) ['level' => ReadConcern::LOCAL] ],
151-
[ new ReadConcern(ReadConcern::MAJORITY), (object) ['level' => ReadConcern::MAJORITY] ],
152-
];
153-
}
154-
155-
/**
156-
* @dataProvider provideWriteConcernsAndDocuments
157-
*/
158-
public function testWriteConcernAsDocument(WriteConcern $writeConcern, $expectedDocument)
159-
{
160-
$this->assertEquals($expectedDocument, \MongoDB\write_concern_as_document($writeConcern));
161-
}
162-
163-
public function provideWriteConcernsAndDocuments()
164-
{
165-
return [
166-
[ new WriteConcern(-3), (object) ['w' => 'majority'] ], // MONGOC_WRITE_CONCERN_W_MAJORITY
167-
[ new WriteConcern(-2), (object) [] ], // MONGOC_WRITE_CONCERN_W_DEFAULT
168-
[ new WriteConcern(-1), (object) ['w' => -1] ],
169-
[ new WriteConcern(0), (object) ['w' => 0] ],
170-
[ new WriteConcern(1), (object) ['w' => 1] ],
171-
[ new WriteConcern('majority'), (object) ['w' => 'majority'] ],
172-
[ new WriteConcern('tag'), (object) ['w' => 'tag'] ],
173-
[ new WriteConcern(1, 0), (object) ['w' => 1] ],
174-
[ new WriteConcern(1, 0, false), (object) ['w' => 1, 'j' => false] ],
175-
[ new WriteConcern(1, 1000), (object) ['w' => 1, 'wtimeout' => 1000] ],
176-
[ new WriteConcern(1, 1000, true), (object) ['w' => 1, 'wtimeout' => 1000, 'j' => true] ],
177-
[ new WriteConcern(-2, 0, true), (object) ['j' => true] ],
178-
// Note: wtimeout is only applicable applies for w > 1
179-
[ new WriteConcern(-2, 1000), (object) ['wtimeout' => 1000] ],
180-
];
181-
}
182137
}

0 commit comments

Comments
 (0)