File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -708,4 +708,19 @@ public function __call($method, $arguments) {
708
708
);
709
709
}
710
710
711
+ /**
712
+ * {@inheritdoc}
713
+ */
714
+ public function __debugInfo () {
715
+ return parent ::__debugInfo () + [
716
+ 'hydrate ' => $ this ->_hydrate ,
717
+ 'buffered ' => $ this ->_useBufferedResults ,
718
+ 'formatters ' => count ($ this ->_formatters ),
719
+ 'mapReducers ' => count ($ this ->_mapReduce ),
720
+ 'contain ' => $ this ->contain (),
721
+ 'extraOptions ' => $ this ->_options ,
722
+ 'repository ' => $ this ->_repository
723
+ ];
724
+ }
725
+
711
726
}
Original file line number Diff line number Diff line change @@ -1767,4 +1767,52 @@ public function testContainInAssociationMatching() {
1767
1767
$ this ->assertEquals ('tag3 ' , $ results [0 ]->articles ->articles_tags ->tag ->name );
1768
1768
}
1769
1769
1770
+ /**
1771
+ * Tests __debugInfo
1772
+ *
1773
+ * @return void
1774
+ */
1775
+ public function testDebugInfo () {
1776
+ $ table = TableRegistry::get ('authors ' );
1777
+ $ table ->hasMany ('articles ' );
1778
+ $ query = $ table ->find ()
1779
+ ->where (['id > ' => 1 ])
1780
+ ->bufferResults (false )
1781
+ ->hydrate (false )
1782
+ ->matching ('articles ' )
1783
+ ->applyOptions (['foo ' => 'bar ' ])
1784
+ ->formatResults (function ($ results ) {
1785
+ return $ results ;
1786
+ })
1787
+ ->mapReduce (function ($ item , $ key , $ mr ) {
1788
+ $ mr ->emit ($ item );
1789
+ });
1790
+
1791
+ $ expected = [
1792
+ 'sql ' => $ query ->sql (),
1793
+ 'params ' => $ query ->valueBinder ()->bindings (),
1794
+ 'defaultTypes ' => [
1795
+ 'authors.id ' => 'integer ' ,
1796
+ 'id ' => 'integer ' ,
1797
+ 'authors.name ' => 'string ' ,
1798
+ 'name ' => 'string '
1799
+ ],
1800
+ 'decorators ' => 0 ,
1801
+ 'executed ' => false ,
1802
+ 'hydrate ' => false ,
1803
+ 'buffered ' => false ,
1804
+ 'formatters ' => 1 ,
1805
+ 'mapReducers ' => 1 ,
1806
+ 'contain ' => [
1807
+ 'articles ' => [
1808
+ 'queryBuilder ' => null ,
1809
+ 'matching ' => true
1810
+ ]
1811
+ ],
1812
+ 'extraOptions ' => ['foo ' => 'bar ' ],
1813
+ 'repository ' => $ table
1814
+ ];
1815
+ $ this ->assertSame ($ expected , $ query ->__debugInfo ());
1816
+ }
1817
+
1770
1818
}
You can’t perform that action at this time.
0 commit comments