public function testMockReader() { //Test our mock is in good order before feeding it to our //reader model $rdr = new MockReader(); $i = 0; $this->assertEquals(1, $rdr->GetPropertyCount()); $this->assertEquals(MgPropertyType::Int32, $rdr->GetPropertyType(0)); $this->assertEquals(MgPropertyType::Int32, $rdr->GetPropertyType("ID")); $clsDef = $rdr->GetClassDefinition(); $props = $clsDef->GetProperties(); $this->assertEquals(1, $props->GetCount()); $this->assertEquals("ID", $props->GetItem(0)->GetName()); $this->assertEquals(MgPropertyType::Int32, $props->GetItem(0)->GetDataType()); while ($rdr->ReadNext()) { $this->assertEquals($i, $rdr->GetInt32(0)); $this->assertEquals($i, $rdr->GetInt32("ID")); try { $rdr->GetInt32(-1); $this->fail("Expected GetInt32 failure"); } catch (Exception $ex) { } try { $rdr->GetInt32(1); $this->fail("Expected GetInt32 failure"); } catch (Exception $ex) { } try { $rdr->GetInt32("IDontExist"); $this->fail("Expected GetInt32 failure"); } catch (Exception $ex) { } $i++; } $rdr->Close(); $this->assertTrue($rdr->WasClosed()); $this->assertEquals(5, $i); }