Skip to content

Commit dad870c

Browse files
committed
PHPLIB-63: Test custom name for index creation
1 parent 66048a4 commit dad870c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/CollectionFunctionalTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public function testCreateIndex()
8484
$that->assertFalse($info->isTtl());
8585
});
8686

87-
$this->assertSame('t_1', $this->collection->createIndex(array('t' => 1), array('expireAfterSeconds' => 0)));
88-
$this->assertIndexExists('t_1', function(IndexInfo $info) use ($that) {
87+
$this->assertSame('my_ttl', $this->collection->createIndex(array('t' => 1), array('expireAfterSeconds' => 0, 'name' => 'my_ttl')));
88+
$this->assertIndexExists('my_ttl', function(IndexInfo $info) use ($that) {
8989
$that->assertFalse($info->isSparse());
9090
$that->assertFalse($info->isUnique());
9191
$that->assertTrue($info->isTtl());
@@ -96,13 +96,13 @@ public function testCreateIndexes()
9696
{
9797
$that = $this;
9898

99-
$expectedNames = array('x_1', 'y_-1_z_1', 'g_2dsphere_z_1', 't_1');
99+
$expectedNames = array('x_1', 'y_-1_z_1', 'g_2dsphere_z_1', 'my_ttl');
100100

101101
$indexes = array(
102102
array('key' => array('x' => 1), 'sparse' => true, 'unique' => true),
103103
array('key' => array('y' => -1, 'z' => 1)),
104104
array('key' => array('g' => '2dsphere', 'z' => 1)),
105-
array('key' => array('t' => 1), 'expireAfterSeconds' => 0),
105+
array('key' => array('t' => 1), 'expireAfterSeconds' => 0, 'name' => 'my_ttl'),
106106
);
107107

108108
$this->assertSame($expectedNames, $this->collection->createIndexes($indexes));
@@ -125,7 +125,7 @@ public function testCreateIndexes()
125125
$that->assertFalse($info->isTtl());
126126
});
127127

128-
$this->assertIndexExists('t_1', function(IndexInfo $info) use ($that) {
128+
$this->assertIndexExists('my_ttl', function(IndexInfo $info) use ($that) {
129129
$that->assertFalse($info->isSparse());
130130
$that->assertFalse($info->isUnique());
131131
$that->assertTrue($info->isTtl());

0 commit comments

Comments
 (0)