Browse Source

Rolling a manual dataProvider, using the one from PHPUnit makes SQlite
sad

Jose Lorenzo Rodriguez 12 years ago
parent
commit
cb87b2d8af
1 changed files with 43 additions and 8 deletions
  1. 43 8
      tests/TestCase/ORM/CompositeKeysTest.php

+ 43 - 8
tests/TestCase/ORM/CompositeKeysTest.php

@@ -61,22 +61,35 @@ class CompositeKeyTest extends TestCase {
 	}
 
 /**
- * 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 @@ class CompositeKeyTest extends TestCase {
  * 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');