8000 #37180 Added collection and database option precedence tests · kralos/symfony@eb8fe01 · GitHub
[go: up one dir, main page]

Skip to content

Commit eb8fe01

Browse files
author
Joe Bennett
committed
symfony#37180 Added collection and database option precedence tests
1 parent 992649d commit eb8fe01

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,28 @@ public function provideInvalidConstructorArgs()
141141
yield ['mongodb://localhost/test', []];
142142
yield ['mongodb://localhost/', []];
143143
}
144+
145+
public function testCollectionDsnPrecedence()
146+
{
147+
$client = self::getMongoClient();
148+
149+
$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);
154+
$this->assertSame('lock_dsn', $options['collection']);
155+
}
156+
157+
public function testDatabaseDsnPrecedence()
158+
{
159+
$client = self::getMongoClient();
160+
161+
$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);
166+
$this->assertSame('test_dsn', $options['database']);
167+
}
144168
}

0 commit comments

Comments
 (0)
0