1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Test array fetching on table finder methods

This commit is contained in:
jackbravo 2007-09-01 19:44:44 +00:00
parent 9b5246368e
commit 7bff012bcb

View File

@ -159,6 +159,17 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
$this->assertTrue(false); $this->assertTrue(false);
} }
try {
$record = $this->objTable->find('4', Doctrine::FETCH_ARRAY);
$this->assertTrue(is_array($record));
$this->assertTrue(!is_object($record));
$this->assertTrue(array_key_exists('id', $record));
$this->assertTrue(array_key_exists('name', $record));
$this->assertTrue(! $record instanceof Doctrine_Record);
} catch(Exception $e) {
$this->assertTrue(false);
}
try { try {
$record = $this->objTable->find(123); $record = $this->objTable->find(123);
$this->assertTrue($record === false); $this->assertTrue($record === false);
@ -186,6 +197,12 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
$users = $this->objTable->findAll(); $users = $this->objTable->findAll();
$this->assertEqual($users->count(), 8); $this->assertEqual($users->count(), 8);
$this->assertTrue($users instanceof Doctrine_Collection); $this->assertTrue($users instanceof Doctrine_Collection);
$users = $this->objTable->findAll(Doctrine::FETCH_ARRAY);
$this->assertTrue(! $users instanceof Doctrine_Collection);
$this->assertTrue(is_array($users));
$this->assertTrue(!is_object($users));
$this->assertEqual(count($users), 8);
} }
public function testFindByDql() public function testFindByDql()