Permalink
Browse files

Edited test associated with that fix

  • Loading branch information...
1 parent b178b28 commit 7f7d725a2116ea5356571b83722ffc24a86a240b @Grafikart Grafikart committed Jan 29, 2014
Showing with 5 additions and 6 deletions.
  1. +3 −4 src/ORM/Table.php
  2. +2 −2 tests/TestCase/ORM/TableTest.php
View
@@ -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();
@@ -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));
@@ -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));

0 comments on commit 7f7d725

Please sign in to comment.