From 5a6d20c7c41c26f6b2db3d518853d931a4c53445 Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Tue, 15 Jan 2013 12:18:47 +0000 Subject: Add ResultSet functionality to Idiorm --- test/ORMTest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test/ORMTest.php') diff --git a/test/ORMTest.php b/test/ORMTest.php index 8a50479..1773d29 100644 --- a/test/ORMTest.php +++ b/test/ORMTest.php @@ -1,7 +1,18 @@ assertEquals('0', ORM::CONDITION_FRAGMENT); $this->assertEquals('1', ORM::CONDITION_VALUES); @@ -44,4 +55,24 @@ class ORMTest extends PHPUnit_Framework_TestCase { $this->assertFalse(isset($model['test'])); } + public function testFindResultSet() { + $result_set = ORM::for_table('test')->find_result_set(); + $this->assertInstanceOf('IdiormResultSet', $result_set); + $this->assertSame(count($result_set), 5); + } + + public function testFindResultSetByDefault() { + ORM::configure('return_result_sets', true); + + $result_set = ORM::for_table('test')->find_many(); + $this->assertInstanceOf('IdiormResultSet', $result_set); + $this->assertSame(count($result_set), 5); + + ORM::configure('return_result_sets', false); + + $result_set = ORM::for_table('test')->find_many(); + $this->assertInternalType('array', $result_set); + $this->assertSame(count($result_set), 5); + } + } \ No newline at end of file -- cgit v1.2.3