Skip to content

Commit

Permalink
Fixing some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jan 27, 2014
1 parent 7d397bc commit fd6a5db
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/Model/Behavior/TranslateBehavior.php
Expand Up @@ -256,6 +256,7 @@ protected function _groupTranslations($results) {
$options = ['setter' => false, 'guard' => false];
$row->set('_translations', $result, $options);
unset($row['_i18n']);
$row->clean();
return $row;
});
}
Expand Down
1 change: 1 addition & 0 deletions src/ORM/Association/HasMany.php
Expand Up @@ -84,6 +84,7 @@ public function eagerLoader(array $options) {
'strategy' => $this->strategy()
];

$queryBuilder = false;
if (!empty($options['queryBuilder'])) {
$queryBuilder = $options['queryBuilder'];
unset($options['queryBuilder']);
Expand Down
16 changes: 0 additions & 16 deletions tests/TestCase/Model/Behavior/TranslateBehaviorTest.php
Expand Up @@ -394,20 +394,4 @@ public function testTranslationsHasManyWithOverride() {
$this->assertEquals('Obsah #1', $results->first()->body);
}

public function testFindSingleLocaleBelongsto() {
$table = TableRegistry::get('Articles');
$table->addBehavior('Translate', ['fields' => ['title', 'body']]);
$authors = $table->belongsTo('Authors')->target();
$authors->addBehavior('Translate', ['fields' => ['name']]);

$table->locale('eng');
$authors->locale('eng');

$results = $table->find()->contain(['Authors' => function($q) {
return $q->select(['id', 'name']);
}]);

debug(json_encode($results->first()->author));
}

}
4 changes: 1 addition & 3 deletions tests/TestCase/ORM/Association/HasManyTest.php
Expand Up @@ -396,9 +396,7 @@ public function testEagerLoaderWithQueryBuilder() {
->with(['a', 'b'])
->will($this->returnSelf());

$query->expects($this->any())->method('join')
->will($this->returnSelf());
$query->expects($this->at(6))->method('join')
$query->expects($this->at(3))->method('join')
->with('foo')
->will($this->returnSelf());

Expand Down

0 comments on commit fd6a5db

Please sign in to comment.