Skip to content

Commit

Permalink
Removing ReflectionMethod::setAccessible() from tests, it was limitin…
Browse files Browse the repository at this point in the history
…g to PHP 5.3.2 or newer.
  • Loading branch information
renan committed Mar 2, 2012
1 parent c84e25e commit 3412c0c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
Expand Up @@ -1085,14 +1085,27 @@ protected function &_prepareAssociationQuery(Model $model, &$queryData, $binding


$linkModel = $model->{$className}; $linkModel = $model->{$className};
$external = isset($assocData['external']); $external = isset($assocData['external']);
$reflection = new ReflectionMethod($this->Dbo, '_scrubQueryData'); $queryData = $this->_scrubQueryData($queryData);
$reflection->setAccessible(true);
$queryData = $reflection->invokeArgs($this->Dbo, array($queryData));


$result = array_merge(array('linkModel' => &$linkModel), compact('type', 'assoc', 'assocData', 'external')); $result = array_merge(array('linkModel' => &$linkModel), compact('type', 'assoc', 'assocData', 'external'));
return $result; return $result;
} }


/**
* Helper method copied from DboSource::_scrubQueryData()
*
* @param array $data
* @return array
*/
function _scrubQueryData($data) {
static $base = null;
if ($base === null) {
$base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array());
$base['callbacks'] = null;
}
return (array)$data + $base;
}

/** /**
* testGenerateInnerJoinAssociationQuery method * testGenerateInnerJoinAssociationQuery method
* *
Expand Down

0 comments on commit 3412c0c

Please sign in to comment.