Permalink
Browse files

Update driver version check in BinDataTest, and copy fix to IdTest

  • Loading branch information...
1 parent 173f4ea commit 848063e5dba3d7ac3f962830a0583455e8aa45b0 @jmikola jmikola committed Jan 15, 2014
@@ -30,9 +30,7 @@ public function provideData()
*
* See: https://jira.mongodb.org/browse/PHP-408
*/
- $expectedBinCustom = (-1 === version_compare('1.2.10', \Mongo::VERSION))
- ? \MongoBinData::CUSTOM
- : -128;
+ $expectedBinCustom = version_compare(phpversion('mongo'), '1.2.11', '<') ? -128 : \MongoBinData::CUSTOM;
return array(
array('bin', 'test', 0),
@@ -295,13 +295,20 @@ public function testBinIds($type, $expectedMongoBinDataType)
public function getTestBinIdsData()
{
+ /* In driver versions before 1.2.11, the custom binary data type is
+ * incorrectly returned as -128.
+ *
+ * See: https://jira.mongodb.org/browse/PHP-408
+ */
+ $expectedBinCustom = version_compare(phpversion('mongo'), '1.2.11', '<') ? -128 : \MongoBinData::CUSTOM;
+
return array(
array('bin', 0),
array('bin_func', \MongoBinData::FUNC),
array('bin_bytearray', \MongoBinData::BYTE_ARRAY),
array('bin_uuid', \MongoBinData::UUID),
array('bin_md5', \MongoBinData::MD5),
- array('bin_custom', \MongoBinData::CUSTOM),
+ array('bin_custom', $expectedBinCustom),
);
}

0 comments on commit 848063e

Please sign in to comment.