@@ -27,6 +27,12 @@ protected function setUp() {
2727 $ this ->dbaCdbFile = tempnam ( $ temp , get_class ( $ this ) . '_ ' );
2828 }
2929
30+ protected function tearDown () {
31+ parent ::tearDown ();
32+ unlink ($ this ->phpCdbFile );
33+ unlink ($ this ->dbaCdbFile );
34+ }
35+
3036 /**
3137 * Make a random-ish string
3238 * @return string
@@ -57,6 +63,8 @@ public function testCdbWrite() {
5763 }
5864 }
5965
66+ unset($ data ['' ]);
67+
6068 $ w1 ->close ();
6169 $ w2 ->close ();
6270
@@ -84,6 +92,31 @@ public function testCdbWrite() {
8492 $ this ->cdbAssert ( "PHP error " , $ key , $ v1 , $ value );
8593 $ this ->cdbAssert ( "DBA error " , $ key , $ v2 , $ value );
8694 }
95+
96+ $ r1 ->close ();
97+ $ r2 ->close ();
98+
99+ $ r1 = new Reader \PHP ( $ this ->phpCdbFile );
100+ $ r2 = new Reader \DBA ( $ this ->dbaCdbFile );
101+
102+ $ keys = array_keys ($ data );
103+ $ firstKey = array_shift ($ keys );
104+
105+ $ this ->assertTrue ($ r1 ->exists ($ firstKey ), 'PHP entry exists ' );
106+ $ this ->assertTrue ($ r2 ->exists ($ firstKey ), 'DBA entry exists ' );
107+ $ this ->assertFalse ($ r1 ->exists (-1 ), 'PHP entry doesn \'t exists ' );
108+ $ this ->assertFalse ($ r2 ->exists (-1 ), 'DBA entry doesn \'t exists ' );
109+
110+ $ firstKey1 = $ r1 ->firstkey ();
111+ $ firstKey2 = $ r2 ->firstkey ();
112+
113+ $ this ->assertEquals ($ firstKey1 , $ firstKey , 'PHP Match first key ' );
114+ $ this ->assertEquals ($ firstKey2 , $ firstKey , 'DBA Match first key ' );
115+
116+ unset($ data [$ firstKey ]);
117+ for ($ j = 0 , $ max = count ($ data ); $ j < $ max ; $ j ++) {
118+ $ this ->assertEquals ($ r2 ->nextkey (), $ r1 ->nextkey (), 'nextkey match ' );
119+ }
87120 }
88121
89122 private function cdbAssert ( $ msg , $ key , $ v1 , $ v2 ) {
0 commit comments