Skip to content

Commit

Permalink
Rolling a manual dataProvider, using the one from PHPUnit makes SQlite
Browse files Browse the repository at this point in the history
sad
  • Loading branch information
lorenzo committed Mar 27, 2014
1 parent e7f5232 commit cb87b2d
Showing 1 changed file with 43 additions and 8 deletions.
51 changes: 43 additions & 8 deletions tests/TestCase/ORM/CompositeKeysTest.php
Expand Up @@ -61,22 +61,35 @@ public function setUp() {
}

/**
* Data provider for the two types of strategies HasMany implements
* Tests that HasMany associations are correctly eager loaded and results
* correctly nested when multiple foreignKeys are used
*
* Uses the select strategy
*
* @return void
*/
public function strategiesProvider() {
return [['subquery'], ['select']];
public function testHasManyEagerSelect() {
$this->_testHasMany('select');
}

/**
* Tests that HasMany associations are correctly eager loaded and results
* correctly nested when multiple foreignKeys are used
* correctly nested when multiple foreignKeys are used.
*
* Uses the subquery startegy
*
* @return void
*/
public function testHasManyEagerSubquery() {
$this->_testHasMany('subquery');
}

/**
* Helper method used to test eager loading of hasMany associations
*
* @dataProvider strategiesProvider
* @return void
*/
public function _testHasManyEager($strategy) {
protected function _testHasMany($strategy) {
$table = TableRegistry::get('SiteAuthors');
$table->hasMany('SiteArticles', [
'propertyName' => 'articles',
Expand Down Expand Up @@ -146,10 +159,32 @@ public function _testHasManyEager($strategy) {
* Tests that BelongsToMany associations are correctly eager loaded when multiple
* foreignKeys are used
*
* @dataProvider strategiesProvider
* Uses the select strategy
*
* @return void
**/
public function _testBelongsToManyEager($strategy) {
public function testBelongsToManyEagerSelect() {
$this->_testBelongsToMany('select');
}

/**
* Tests that BelongsToMany associations are correctly eager loaded when multiple
* foreignKeys are used
*
* Uses the subquery strategy
*
* @return void
**/
public function testBelongsToManyEagerSubquery() {
$this->_testBelongsToMany('subquery');
}

/**
* Helper method used to test eager loding of BelongsToMany associations
*
* @return void
*/
protected function _testBelongsToMany($strategy) {
$articles = TableRegistry::get('SiteArticles');
$tags = TableRegistry::get('SiteTags');
$junction = TableRegistry::get('SiteArticlesTags');
Expand Down

0 comments on commit cb87b2d

Please sign in to comment.