Skip to content

Commit

Permalink
Edited test associated with that fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Grafikart committed Jan 29, 2014
1 parent b178b28 commit 7f7d725
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/ORM/Table.php
Expand Up @@ -887,10 +887,9 @@ protected function _setFieldMatchers($options, $keys) {
*/
public function get($primaryKey, $options = []) {
$key = (array)$this->primaryKey();
if (!empty($this->_alias)) {
foreach($key as $index => $keyname){
$key[$index] = $this->_alias . '.' . $keyname;
}
$alias = $this->alias();
foreach ($key as $index => $keyname) {
$key[$index] = $alias . '.' . $keyname;
}
$conditions = array_combine($key, (array)$primaryKey);
$entity = $this->find('all', $options)->where($conditions)->first();
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/ORM/TableTest.php
Expand Up @@ -3045,7 +3045,7 @@ public function testGet() {
->will($this->returnValue($query));

$query->expects($this->once())->method('where')
->with(['bar' => 10])
->with([$table->alias() . '.bar' => 10])
->will($this->returnSelf());
$query->expects($this->once())->method('first')
->will($this->returnValue($entity));
Expand Down Expand Up @@ -3088,7 +3088,7 @@ public function testGetException() {
->will($this->returnValue($query));

$query->expects($this->once())->method('where')
->with(['bar' => 10])
->with([$table->alias() . '.bar' => 10])
->will($this->returnSelf());
$query->expects($this->once())->method('first')
->will($this->returnValue(false));
Expand Down

0 comments on commit 7f7d725

Please sign in to comment.