|
|
@@ -103,20 +103,40 @@ class QueryTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Provides strategies for associations that can be joined
|
|
|
+ * Data provider for the two types of strategies HasMany implements
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function strategiesProviderHasMany()
|
|
|
+ {
|
|
|
+ return [['subquery'], ['select']];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Data provider for the two types of strategies BelongsTo implements
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function strategiesProviderBelongsTo()
|
|
|
+ {
|
|
|
+ return [['join'], ['select']];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Data provider for the two types of strategies BelongsToMany implements
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function internalStategiesProvider()
|
|
|
+ public function strategiesProviderBelongsToMany()
|
|
|
{
|
|
|
- return [['join'], ['select'], ['subquery']];
|
|
|
+ return [['subquery'], ['select']];
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Tests that results are grouped correctly when using contain()
|
|
|
* and results are not hydrated
|
|
|
*
|
|
|
- * @dataProvider internalStategiesProvider
|
|
|
+ * @dataProvider strategiesProviderBelongsTo
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testContainResultFetchingOneLevel($strategy)
|
|
|
@@ -169,22 +189,12 @@ class QueryTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Data provider for the two types of strategies HasMany implements
|
|
|
- *
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function strategiesProvider()
|
|
|
- {
|
|
|
- return [['subquery'], ['select']];
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* Tests that HasMany associations are correctly eager loaded and results
|
|
|
* correctly nested when no hydration is used
|
|
|
* Also that the query object passes the correct parent model keys to the
|
|
|
* association objects in order to perform eager loading with select strategy
|
|
|
*
|
|
|
- * @dataProvider strategiesProvider
|
|
|
+ * @dataProvider strategiesProviderHasMany
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testHasManyEagerLoadingNoHydration($strategy)
|
|
|
@@ -263,7 +273,7 @@ class QueryTest extends TestCase
|
|
|
* Tests that it is possible to count results containing hasMany associations
|
|
|
* both hydrating and not hydrating the results.
|
|
|
*
|
|
|
- * @dataProvider strategiesProvider
|
|
|
+ * @dataProvider strategiesProviderHasMany
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testHasManyEagerLoadingCount($strategy)
|
|
|
@@ -294,7 +304,7 @@ class QueryTest extends TestCase
|
|
|
/**
|
|
|
* Tests that it is possible to set fields & order in a hasMany result set
|
|
|
*
|
|
|
- * @dataProvider strategiesProvider
|
|
|
+ * @dataProvider strategiesProviderHasMany
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testHasManyEagerLoadingFieldsAndOrderNoHydration($strategy)
|
|
|
@@ -346,7 +356,7 @@ class QueryTest extends TestCase
|
|
|
/**
|
|
|
* Tests that deep associations can be eagerly loaded
|
|
|
*
|
|
|
- * @dataProvider strategiesProvider
|
|
|
+ * @dataProvider strategiesProviderHasMany
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testHasManyEagerLoadingDeep($strategy)
|
|
|
@@ -420,7 +430,7 @@ class QueryTest extends TestCase
|
|
|
* Tests that hasMany associations can be loaded even when related to a secondary
|
|
|
* model in the query
|
|
|
*
|
|
|
- * @dataProvider strategiesProvider
|
|
|
+ * @dataProvider strategiesProviderHasMany
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testHasManyEagerLoadingFromSecondaryTable($strategy)
|
|
|
@@ -526,7 +536,7 @@ class QueryTest extends TestCase
|
|
|
* Also that the query object passes the correct parent model keys to the
|
|
|
* association objects in order to perform eager loading with select strategy
|
|
|
*
|
|
|
- * @dataProvider strategiesProvider
|
|
|
+ * @dataProvider strategiesProviderBelongsToMany
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testBelongsToManyEagerLoadingNoHydration($strategy)
|
|
|
@@ -1278,7 +1288,7 @@ class QueryTest extends TestCase
|
|
|
/**
|
|
|
* Tests that belongsTo relations are correctly hydrated
|
|
|
*
|
|
|
- * @dataProvider internalStategiesProvider
|
|
|
+ * @dataProvider strategiesProviderBelongsTo
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testHydrateBelongsTo($strategy)
|
|
|
@@ -1303,7 +1313,7 @@ class QueryTest extends TestCase
|
|
|
/**
|
|
|
* Tests that deeply nested associations are also hydrated correctly
|
|
|
*
|
|
|
- * @dataProvider internalStategiesProvider
|
|
|
+ * @dataProvider strategiesProviderBelongsTo
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testHydrateDeep($strategy)
|
|
|
@@ -2201,7 +2211,7 @@ class QueryTest extends TestCase
|
|
|
* Tests that it is possible to use the same association aliases in the association
|
|
|
* chain for contain
|
|
|
*
|
|
|
- * @dataProvider internalStategiesProvider
|
|
|
+ * @dataProvider strategiesProviderBelongsTo
|
|
|
* @return void
|
|
|
*/
|
|
|
public function testRepeatedAssociationAliases($strategy)
|