Skip to content
This repository
Browse code

Removing ReflectionMethod::setAccessible() from tests, it was limitin…

…g to PHP 5.3.2 or newer.
  • Loading branch information...
commit 6d3bc7be86ccb512a3c9ea32048f278ef1da9390 1 parent 8e93c4c
Renan Gonçalves authored
19  lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -1082,15 +1082,28 @@ function &_prepareAssociationQuery($model, &$queryData, $binding) {
1082 1082
 
1083 1083
 		$linkModel = $model->{$className};
1084 1084
 		$external = isset($assocData['external']);
1085  
-		$reflection = new ReflectionMethod($this->Dbo, '_scrubQueryData');
1086  
-		$reflection->setAccessible(true);
1087  
-		$queryData = $reflection->invokeArgs($this->Dbo, array($queryData));
  1085
+		$queryData = $this->_scrubQueryData($queryData);
1088 1086
 
1089 1087
 		$result = array_merge(array('linkModel' => &$linkModel), compact('type', 'assoc', 'assocData', 'external'));
1090 1088
 		return $result;
1091 1089
 	}
1092 1090
 
1093 1091
 /**
  1092
+ * Helper method copied from DboSource::_scrubQueryData()
  1093
+ *
  1094
+ * @param array $data
  1095
+ * @return array
  1096
+ */
  1097
+	function _scrubQueryData($data) {
  1098
+		static $base = null;
  1099
+		if ($base === null) {
  1100
+			$base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array());
  1101
+			$base['callbacks'] = null;
  1102
+		}
  1103
+		return (array)$data + $base;
  1104
+	}
  1105
+
  1106
+/**
1094 1107
  * testGenerateInnerJoinAssociationQuery method
1095 1108
  *
1096 1109
  * @return void

0 notes on commit 6d3bc7b

Please sign in to comment.
Something went wrong with that request. Please try again.