Skip to content

Commit e2384aa

Browse files
committed
Unit test for IndexInfo's ArrayAccess implementation
1 parent 4f7349e commit e2384aa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/Model/IndexInfoTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ public function testDebugInfo()
9797
$this->assertSame($expectedInfo, $info->__debugInfo());
9898
}
9999

100+
public function testImplementsArrayAccess()
101+
{
102+
$info = new IndexInfo([
103+
'v' => 1,
104+
'key' => ['x' => 1],
105+
'name' => 'x_1',
106+
'ns' => 'foo.bar',
107+
]);
108+
109+
$this->assertInstanceOf('ArrayAccess', $info);
110+
$this->assertTrue(isset($info['name']));
111+
$this->assertSame('x_1', $info['name']);
112+
}
113+
100114
/**
101115
* @expectedException MongoDB\Exception\BadMethodCallException
102116
* @expectedExceptionMessage MongoDB\Model\IndexInfo is immutable

0 commit comments

Comments
 (0)