diff --git a/tests/TestCase/ORM/CompositeKeysTest.php b/tests/TestCase/ORM/CompositeKeysTest.php index a6e9bf421ed..fbf3125287f 100644 --- a/tests/TestCase/ORM/CompositeKeysTest.php +++ b/tests/TestCase/ORM/CompositeKeysTest.php @@ -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', @@ -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');