Test array fetching on table finder methods
This commit is contained in:
parent
9b5246368e
commit
7bff012bcb
@ -159,6 +159,17 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
|
||||
$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 {
|
||||
$record = $this->objTable->find(123);
|
||||
$this->assertTrue($record === false);
|
||||
@ -186,6 +197,12 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
|
||||
$users = $this->objTable->findAll();
|
||||
$this->assertEqual($users->count(), 8);
|
||||
$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()
|
||||
|
Loading…
Reference in New Issue
Block a user