Permalink
Browse files

Added __debugInfo to ResultSet

  • Loading branch information...
1 parent 6e6b5b8 commit ad4c4fdceb74c8b2e92aa47d19a6014168ba6fa1 @lorenzo lorenzo committed Mar 10, 2014
Showing with 28 additions and 0 deletions.
  1. +13 −0 src/ORM/ResultSet.php
  2. +15 −0 tests/TestCase/ORM/ResultSetTest.php
View
@@ -439,4 +439,17 @@ protected function _bufferResult($result) {
}
}
+/**
+ * Returns an array that can be used to describe the internal state of this
+ * object.
+ *
+ * @return array
+ */
+ public function __debugInfo() {
+ return [
+ 'query' => $this->_query,
+ 'items' => $this->toArray(),
+ ];
+ }
+
}
@@ -230,4 +230,19 @@ public function testGroupBy() {
$this->assertEquals($expected, $results);
}
+/**
+ * Tests __debugInfo
+ *
+ * @return void
+ */
+ public function testDebugInfo() {
+ $query = $this->table->find('all');
+ $results = $query->all();
+ $expected = [
+ 'query' => $query,
+ 'items' => $results->toArray()
+ ];
+ $this->assertSame($expected, $results->__debugInfo());
+ }
+
}

0 comments on commit ad4c4fd

Please sign in to comment.