summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--167.patch141
-rw-r--r--php-alcaeus-mongo-php-adapter.spec14
2 files changed, 150 insertions, 5 deletions
diff --git a/167.patch b/167.patch
new file mode 100644
index 0000000..846b811
--- /dev/null
+++ b/167.patch
@@ -0,0 +1,141 @@
+From 0cf254b9a28ccf8aa9e0e18f802b63d58f3e5e92 Mon Sep 17 00:00:00 2001
+From: Emir Beganovic <beganovic.emir@gmail.com>
+Date: Tue, 11 Apr 2017 20:53:00 +0200
+Subject: [PATCH 1/2] Check different behaviour for index version for MongoDB
+ 3.4
+
+---
+ .travis.yml | 134 ++++++++++++++++++---
+ .../MongoDbAdapter/Mongo/MongoCollectionTest.php | 22 ++--
+ tests/Alcaeus/MongoDbAdapter/Mongo/TestCase.php | 0
+ tests/Alcaeus/MongoDbAdapter/TestCase.php | 11 ++
+ 4 files changed, 139 insertions(+), 28 deletions(-)
+ create mode 100644 tests/Alcaeus/MongoDbAdapter/Mongo/TestCase.php
+
+diff --git a/tests/Alcaeus/MongoDbAdapter/Mongo/MongoCollectionTest.php b/tests/Alcaeus/MongoDbAdapter/Mongo/MongoCollectionTest.php
+index 52a163f..b1f1ede 100644
+--- a/tests/Alcaeus/MongoDbAdapter/Mongo/MongoCollectionTest.php
++++ b/tests/Alcaeus/MongoDbAdapter/Mongo/MongoCollectionTest.php
+@@ -1301,12 +1301,14 @@ public function testDeleteIndexesForNonExistingCollection()
+ $this->assertSame($expected, $this->getcollection('nonExisting')->deleteIndexes());
+ }
+
+- public static function dataGetIndexInfo()
++ public function dataGetIndexInfo()
+ {
++ $indexVersion = $this->getDefaultIndexVersion();
++
+ return [
+ 'plainIndex' => [
+ 'expectedIndex' => [
+- 'v' => 1,
++ 'v' => $indexVersion,
+ 'key' => ['foo' => 1],
+ 'name' => 'foo_1',
+ 'ns' => 'mongo-php-adapter.test',
+@@ -1316,7 +1318,7 @@ public static function dataGetIndexInfo()
+ ],
+ 'uniqueIndex' => [
+ 'expectedIndex' => [
+- 'v' => 1,
++ 'v' => $indexVersion,
+ 'key' => ['foo' => 1],
+ 'name' => 'foo_1',
+ 'ns' => 'mongo-php-adapter.test',
+@@ -1327,7 +1329,7 @@ public static function dataGetIndexInfo()
+ ],
+ 'sparseIndex' => [
+ 'expectedIndex' => [
+- 'v' => 1,
++ 'v' => $indexVersion,
+ 'key' => ['foo' => 1],
+ 'name' => 'foo_1',
+ 'ns' => 'mongo-php-adapter.test',
+@@ -1338,7 +1340,7 @@ public static function dataGetIndexInfo()
+ ],
+ 'ttlIndex' => [
+ 'expectedIndex' => [
+- 'v' => 1,
++ 'v' => $indexVersion,
+ 'key' => ['foo' => 1],
+ 'name' => 'foo_1',
+ 'ns' => 'mongo-php-adapter.test',
+@@ -1349,7 +1351,7 @@ public static function dataGetIndexInfo()
+ ],
+ 'textIndex' => [
+ 'expectedIndex' => [
+- 'v' => 1,
++ 'v' => $indexVersion,
+ 'key' => [
+ '_fts' => 'text',
+ '_ftsx' => 1,
+@@ -1368,7 +1370,7 @@ public static function dataGetIndexInfo()
+ ],
+ 'partialFilterExpression' => [
+ 'expectedIndex' => [
+- 'v' => 1,
++ 'v' => $indexVersion,
+ 'key' => ['foo' => 1],
+ 'name' => 'foo_1',
+ 'ns' => 'mongo-php-adapter.test',
+@@ -1383,7 +1385,7 @@ public static function dataGetIndexInfo()
+ ],
+ 'geoSpatial' => [
+ 'expectedIndex' => [
+- 'v' => 1,
++ 'v' => $indexVersion,
+ 'key' => ['foo' => '2dsphere'],
+ 'name' => 'foo_2dsphere',
+ 'ns' => 'mongo-php-adapter.test',
+@@ -1394,7 +1396,7 @@ public static function dataGetIndexInfo()
+ ],
+ 'geoHaystack' => [
+ 'expectedIndex' => [
+- 'v' => 1,
++ 'v' => $indexVersion,
+ 'key' => ['foo' => 'geoHaystack', 'bar' => 1],
+ 'name' => 'foo_geoHaystack_bar_1',
+ 'ns' => 'mongo-php-adapter.test',
+@@ -1412,7 +1414,7 @@ public static function dataGetIndexInfo()
+ public function testGetIndexInfo($expectedIndex, $fields, $options)
+ {
+ $idIndex = [
+- 'v' => 1,
++ 'v' => $this->getDefaultIndexVersion(),
+ 'key' => ['_id' => 1],
+ 'name' => '_id_',
+ 'ns' => 'mongo-php-adapter.test',
+diff --git a/tests/Alcaeus/MongoDbAdapter/Mongo/TestCase.php b/tests/Alcaeus/MongoDbAdapter/Mongo/TestCase.php
+new file mode 100644
+index 0000000..e69de29
+diff --git a/tests/Alcaeus/MongoDbAdapter/TestCase.php b/tests/Alcaeus/MongoDbAdapter/TestCase.php
+index 6964357..3dd96d6 100644
+--- a/tests/Alcaeus/MongoDbAdapter/TestCase.php
++++ b/tests/Alcaeus/MongoDbAdapter/TestCase.php
+@@ -163,4 +163,15 @@ protected function skipTestIf($condition)
+ $this->markTestSkipped('Test only applies when running against mongo-php-adapter');
+ }
+ }
++
++ /**
++ * Indexes created in MongoDB 3.4 default to v: 2.
++ * @return int
++ * @see https://docs.mongodb.com/manual/release-notes/3.4-compatibility/#backwards-incompatible-features
++ */
++ protected function getDefaultIndexVersion()
++ {
++ $serverInfo = $this->getDatabase()->command(array('buildinfo' => true));
++ return isset($serverInfo['version']) && version_compare($serverInfo['version'], '3.4.0', '>=') ? 2 : 1;
++ }
+ }
+
+From 425d996ec86c5e5c93ae61bb1d0caf26cf06bda4 Mon Sep 17 00:00:00 2001
+From: Emir Beganovic <beganovic.emir@gmail.com>
+Date: Wed, 12 Apr 2017 01:51:41 +0200
+Subject: [PATCH 2/2] One-liner
+
+---
+ .travis.yml | 1 -
+ 1 file changed, 1 deletion(-)
+
+
diff --git a/php-alcaeus-mongo-php-adapter.spec b/php-alcaeus-mongo-php-adapter.spec
index 5a9a728..955606e 100644
--- a/php-alcaeus-mongo-php-adapter.spec
+++ b/php-alcaeus-mongo-php-adapter.spec
@@ -14,9 +14,7 @@
# Server only available on LE arch (ExcludeArch: ppc ppc64 %{sparc} s390 s390x)
%global with_tests 0%{?_with_tests:1}
# remirepo:5
-# Test suite rely on MongoDB server 3.2
-# https://github.com/alcaeus/mongo-php-adapter/issues/164
-%if 0%{?fedora} >= 24 && 0%{?fedora} <= 25
+%if 0%{?fedora} >= 24
%global with_tests 0%{!?_without_tests:1}
%endif
%global ns_vendor Alcaeus
@@ -24,7 +22,7 @@
Name: php-%{gh_owner}-%{gh_project}
Version: 1.0.10
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Mongo PHP Adapter
Group: Development/Libraries
@@ -32,6 +30,8 @@ License: MIT
URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}-%{?gh_short}.tar.gz
+Patch0: 167.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php-fedora-autoloader-devel
@@ -82,7 +82,7 @@ Autoloader: %{_datadir}/php/%{ns_vendor}/MongoDbAdapter/autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit}
-
+%patch0 -p1
mv lib/Mongo lib/%{ns_vendor}/Mongo
@@ -171,6 +171,10 @@ rm -rf %{buildroot}
%changelog
+* Wed Apr 12 2017 Remi Collet <remi@remirepo.net> - 1.0.10-2
+- add patch from https://github.com/alcaeus/mongo-php-adapter/pull/167
+- enable test suite with mongodb 3.1 (F26)
+
* Thu Mar 30 2017 Remi Collet <remi@remirepo.net> - 1.0.10-1
- Update to 1.0.10