8000 #37180 Added test for stripping collection from dsn · kralos/symfony@e8c54dd · GitHub
[go: up one dir, main page]

Skip to content

Commit e8c54dd

Browse files
author
Joe Bennett
committed
symfony#37180 Added test for stripping collection from dsn
1 parent 89f879e commit e8c54dd

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,16 @@ public function testCollectionDsnPrecedence()
147147
$client = self::getMongoClient();
148148

149149
$store = new MongoDbStore('mongodb://localhost/test?collection=lock_dsn', ['collection' => 'lock_option']);
150-
$r = new \ReflectionObject($store);
151-
$p = $r->getProperty('options');
152-
$p->setAccessible(true);
153-
$options = $p->getValue($store);
150+
$storeReflection = new \ReflectionObject($store);
151+
152+
$uriProperty = $storeReflection->getProperty('uri');
153+
$uriProperty->setAccessible(true);
154+
$uri = $uriProperty->getValue($store);
155+
$this->assertSame('mongodb://localhost/test', $uri);
156+
157+
$optionsProperty = $storeReflection->getProperty('options');
158+
$optionsProperty->setAccessible(true);
159+
$options = $optionsProperty->getValue($store);
154160
$this->assertSame('lock_dsn', $options['collection']);
155161
}
156162

@@ -159,10 +165,10 @@ public function testDatabaseDsnPrecedence()
159165
$client = self::getMongoClient();
160166

161167
$store = new MongoDbStore('mongodb://localhost/test_dsn', ['database' => 'test_option']);
162-
$r = new \ReflectionObject($store);
163-
$p = $r->getProperty('options');
164-
$p->setAccessible(true);
165-
$options = $p->getValue($store);
168+
$storeReflection = new \ReflectionObject($store);
169+
$optionsProperty = $storeReflection->getProperty('options');
170+
$optionsProperty->setAccessible(true);
171+
$options = $optionsProperty->getValue($store);
166172
$this->assertSame('test_dsn', $options['database']);
167173
}
168174
}

0 commit comments

Comments
 (0)
0