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 3412c0cb0fa90217b7a5cd2c786f6170674e2e5d 1 parent c84e25e
Renan Gonçalves authored March 02, 2012
19  lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -1085,15 +1085,28 @@ protected function &_prepareAssociationQuery(Model $model, &$queryData, $binding
1085 1085
 
1086 1086
 		$linkModel = $model->{$className};
1087 1087
 		$external = isset($assocData['external']);
1088  
-		$reflection = new ReflectionMethod($this->Dbo, '_scrubQueryData');
1089  
-		$reflection->setAccessible(true);
1090  
-		$queryData = $reflection->invokeArgs($this->Dbo, array($queryData));
  1088
+		$queryData = $this->_scrubQueryData($queryData);
1091 1089
 
1092 1090
 		$result = array_merge(array('linkModel' => &$linkModel), compact('type', 'assoc', 'assocData', 'external'));
1093 1091
 		return $result;
1094 1092
 	}
1095 1093
 
1096 1094
 /**
  1095
+ * Helper method copied from DboSource::_scrubQueryData()
  1096
+ *
  1097
+ * @param array $data
  1098
+ * @return array
  1099
+ */
  1100
+	function _scrubQueryData($data) {
  1101
+		static $base = null;
  1102
+		if ($base === null) {
  1103
+			$base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array());
  1104
+			$base['callbacks'] = null;
  1105
+		}
  1106
+		return (array)$data + $base;
  1107
+	}
  1108
+
  1109
+/**
1097 1110
  * testGenerateInnerJoinAssociationQuery method
1098 1111
  *
1099 1112
  * @return void

0 notes on commit 3412c0c

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