Skip to content

Commit

Permalink
Cleaning up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Conroy committed Mar 7, 2015
1 parent d3905cb commit 24df08d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
20 changes: 13 additions & 7 deletions tests/TestCase/ORM/Association/HasManyTest.php
Expand Up @@ -120,13 +120,19 @@ public function testRequiresKeys()
$this->assertFalse($assoc->requiresKeys());
$assoc->strategy(HasMany::STRATEGY_SELECT);
$this->assertTrue($assoc->requiresKeys());
$errorUsingJoin = false;
try {
$assoc->strategy(HasMany::STRATEGY_JOIN);
} catch (\InvalidArgumentException $e) {
$errorUsingJoin = true;
}
$this->assertTrue($errorUsingJoin);
}

/**
* Tests that HasMany can't use the join strategy
*
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Invalid strategy "join" was provided
* @return void
*/
public function testStrategyFailure()
{
$assoc = new HasMany('Test');
$assoc->strategy(HasMany::STRATEGY_JOIN);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/TestCase/ORM/QueryRegressionTest.php
Expand Up @@ -780,7 +780,9 @@ public function testFindMatchingWithContain()
public function testHasManyEagerLoadingUniqueKey()
{
$table = TableRegistry::get('ArticlesTags');
$table->belongsTo('Articles');
$table->belongsTo('Articles', [
'strategy' => 'select'
]);

$result = $table->find()
->contain(['Articles' => function ($q) {
Expand Down
2 changes: 0 additions & 2 deletions tests/TestCase/ORM/QueryTest.php
Expand Up @@ -19,8 +19,6 @@
use Cake\Database\Expression\QueryExpression;
use Cake\Database\TypeMap;
use Cake\Datasource\ConnectionManager;
use Cake\ORM\Association\BelongsTo;
use Cake\ORM\Association\HasOne;
use Cake\ORM\Query;
use Cake\ORM\ResultSet;
use Cake\ORM\Table;
Expand Down

0 comments on commit 24df08d

Please sign in to comment.