Skip to content

Commit 1b8fb30

Browse files
authored
Merge pull request #30 from redthor/v2/drop-php-adapter
V2/drop php adapter
2 parents 0bb1bdf + 04aa8dd commit 1b8fb30

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ before_script:
1919
# Remove xdebug at the start
2020
- phpenv config-rm xdebug.ini
2121
- pecl install -f mongodb-stable
22+
# Until doctrine/mongo switches to mongodb driver
2223
- composer config "platform.ext-mongo" "1.6.16"
2324
- composer self-update
2425
# To be removed when this issue is resolved: https://github.com/composer/composer/issues/5355

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"php": "^7.1",
1717
"doctrine/mongodb": "^1.0",
1818
"symfony/console": "^2.7|^3.3|^4",
19-
"symfony/yaml": "^2.7|^3.3|^4",
20-
"alcaeus/mongo-php-adapter": "^1.0"
19+
"symfony/yaml": "^2.7|^3.3|^4"
2120
},
2221
"require-dev": {
2322
"phpunit/phpunit": "^7.0",

src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use AntiMattr\MongoDB\Migrations\OutputWriter;
1818
use AntiMattr\MongoDB\Migrations\Version;
1919
use Doctrine\MongoDB\Connection;
20+
use Doctrine\MongoDB\Database;
2021

2122
/**
2223
* @author Matthew Fitzgerald <matthewfitz@gmail.com>
@@ -172,9 +173,9 @@ public function getConnection()
172173
}
173174

174175
/**
175-
* @return Doctrine\MongoDB\Connection
176+
* @return Doctrine\MongoDB\Database
176177
*/
177-
public function getDatabase()
178+
public function getDatabase(): ?Database
178179
{
179180
if (isset($this->database)) {
180181
return $this->database;

src/AntiMattr/MongoDB/Migrations/Version.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Doctrine\MongoDB\Collection;
1919
use Doctrine\MongoDB\Database;
2020
use Exception;
21-
use MongoTimestamp;
21+
use MongoDB\BSON\UTCDateTime;
2222

2323
/**
2424
* @author Matthew Fitzgerald <matthewfitz@gmail.com>
@@ -382,11 +382,11 @@ protected function createMigration()
382382
}
383383

384384
/**
385-
* @return MongoTimestamp
385+
* @return UTCDateTime
386386
*/
387387
protected function createMongoTimestamp()
388388
{
389-
return new MongoTimestamp();
389+
return new UTCDateTime();
390390
}
391391

392392
/**

tests/AntiMattr/Tests/MongoDB/Migrations/Configuration/ConfigurationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testGetCurrentVersion()
6565
->with('antimattr_migration_versions_test')
6666
->will($this->returnValue($collection));
6767

68-
$cursor = $this->buildMock('MongoCursor');
68+
$cursor = $this->buildMock('Doctrine\MongoDB\Cursor');
6969

7070
$in = ['v' => ['$in' => ['20140822185742', '20140822185743', '20140822185744']]];
7171

@@ -160,7 +160,7 @@ public function testGetNumberOfExecutedMigrations()
160160
->with('antimattr_migration_versions_test')
161161
->will($this->returnValue($collection));
162162

163-
$cursor = $this->buildMock('MongoCursor');
163+
$cursor = $this->buildMock('Doctrine\MongoDB\Cursor');
164164

165165
$collection->expects($this->once())
166166
->method('find')

tests/AntiMattr/Tests/MongoDB/Migrations/VersionTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use AntiMattr\MongoDB\Migrations\Version;
77
use AntiMattr\TestCase\AntiMattrTestCase;
88
use Doctrine\MongoDB\Database;
9+
use MongoDB\BSON\UTCDateTime;
910

1011
class VersionTest extends AntiMattrTestCase
1112
{
@@ -54,7 +55,7 @@ public function testConstructor()
5455
$this->assertNotNull($this->version->getMigration());
5556
}
5657

57-
public function testAnalyzeThrowsMongoException()
58+
public function testAnalyzeThrowsException()
5859
{
5960
$collection = $this->buildMock('Doctrine\MongoDB\Collection');
6061
$this->statistics->expects($this->once())
@@ -65,7 +66,7 @@ public function testAnalyzeThrowsMongoException()
6566
->method('getName')
6667
->will($this->returnValue('test_name'));
6768

68-
$expectedException = new \MongoException();
69+
$expectedException = new \RuntimeException();
6970

7071
$this->statistics->expects($this->once())
7172
->method('updateBefore')
@@ -99,7 +100,7 @@ public function testAnalyze()
99100

100101
public function testMarkMigrated()
101102
{
102-
$timestamp = $this->buildMock('MongoTimestamp');
103+
$timestamp = new UTCDateTime();
103104
$this->version->setTimestamp($timestamp);
104105

105106
$collection = $this->buildMock('Doctrine\MongoDB\Collection');
@@ -124,7 +125,7 @@ public function testMarkMigrated()
124125

125126
public function testMarkMigratedWithReplay()
126127
{
127-
$timestamp = $this->buildMock('MongoTimestamp');
128+
$timestamp = new UTCDateTime();
128129
$this->version->setTimestamp($timestamp);
129130

130131
$collection = $this->buildMock('Doctrine\MongoDB\Collection');
@@ -154,7 +155,7 @@ public function testMarkMigratedWithReplay()
154155

155156
public function testMarkNotMigrated()
156157
{
157-
$timestamp = $this->buildMock('MongoTimestamp');
158+
$timestamp = new UTCDateTime();
158159
$this->version->setTimestamp($timestamp);
159160

160161
$collection = $this->buildMock('Doctrine\MongoDB\Collection');
@@ -176,14 +177,14 @@ public function testMarkNotMigrated()
176177
$this->version->markNotMigrated();
177178
}
178179

179-
public function testUpdateStatisticsAfterThrowsMongoException()
180+
public function testUpdateStatisticsAfterThrowsException()
180181
{
181182
$collection = $this->buildMock('Doctrine\MongoDB\Collection');
182183
$this->statistics->expects($this->once())
183184
->method('setCollection')
184185
->with($collection);
185186

186-
$expectedException = new \MongoException();
187+
$expectedException = new \RuntimeException();
187188

188189
$this->statistics->expects($this->once())
189190
->method('updateAfter')

0 commit comments

Comments
 (0)