3 class ArrayTest
extends PHPUnit_Framework_TestCase
11 $this->assertEquals($m1->count(), count($m1));
12 $this->assertEquals($m2->count(), count($m2));
15 function testArrayAccess()
19 foreach ($m2 as $item) {
20 $this->assertFalse(isset($item['foobar']));
21 $this->assertTrue(isset($item['a']));
22 $this->assertEquals($item['a'], $item->a
);
23 $item['foobar'] = rand(1, 1000);
24 $this->assertEquals($item['foobar'], $item->foobar
);
28 function testUnsetIsset()
32 $this->assertTrue(isset($c['a']));
34 $this->assertFalse(isset($c['a']));
37 function testScalarToArray()
44 $c->a
[0] = array(1,2);
52 $c->where('_id', $id);
55 $this->assertEquals(array(array(1,2), 3), $c->a
);
59 function testArrayUnsetNull()
61 $arr = array(1,2,3,4);
65 unset($arr[1], $arr[3]);
69 $this->assertEquals($arr, $doc->arr
);