From 7bff012bcbd0ae26f7c0432840ec8fe03872ff1b Mon Sep 17 00:00:00 2001 From: jackbravo Date: Sat, 1 Sep 2007 19:44:44 +0000 Subject: [PATCH] Test array fetching on table finder methods --- tests/TableTestCase.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/TableTestCase.php b/tests/TableTestCase.php index acf3ea03a..943745198 100644 --- a/tests/TableTestCase.php +++ b/tests/TableTestCase.php @@ -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()