PHP Class RedUNIT\Base\Cross

Tests self referential many-to-many relations, including the aggr feature.
Author: Gabor de Mooij and the RedBeanPHP Community
Inheritance: extends RedUNIT\Base
Show file Open project: gabordemooij/redbean

Public Methods

Method Description
testAggrBasic ( ) : void Test aggr without the aliasing.
testAggrNullHandling ( ) : void Test how well aggr handles fields with no values.
testAggrWithOnlyAlias ( ) : void Test aggr with basic aliasing.
testAggregationInSelfRefNM ( ) : void Shared lists can only be formed using types.
testErrorHandlingAggr ( ) : void The aggr method can only be used with own-list.
testSelfReferential ( ) : void Test self referential N-M relations (page_page).
testSelfReferentialCRUD ( ) : void Test many different scenarios with self referential many-to-many relations.
testUnique ( ) : void Test the unique constraint.

Method Details

testAggrBasic() public method

Test aggr without the aliasing.
public testAggrBasic ( ) : void
return void

testAggrNullHandling() public method

Test how well aggr handles fields with no values.
public testAggrNullHandling ( ) : void
return void

testAggrWithOnlyAlias() public method

Test aggr with basic aliasing.
public testAggrWithOnlyAlias ( ) : void
return void

testAggregationInSelfRefNM() public method

If you happen to have two beans of the same type you can still have a shared list but not with a sense of direction. I.e. quest->sharedQuest returns all the quests that follow the first one, but also the ones that are followed by the first one. If you want to have some sort of direction; i.e. one quest follows another one you'll have to use an alias: quest->target, but now you can't use the shared list anymore because it will start looking for a type named 'target' (which is just an alias) for quest, but it cant find that table and it's not possible to 'keep remembering' the alias throughout the system. The aggr() method solves this inconvenience. Aggr iterates through the list identified by its first argument ('target' -> ownQuestTargetList) and fetches every ID of the target (quest_target.target_id), loads these beans in batch for optimal performance, puts them back in the beans (questTarget->target) and returns the references.
public testAggregationInSelfRefNM ( ) : void
return void

testErrorHandlingAggr() public method

The aggr method can only be used with own-list.
public testErrorHandlingAggr ( ) : void
return void

testSelfReferential() public method

Test self referential N-M relations (page_page).
public testSelfReferential ( ) : void
return void

testSelfReferentialCRUD() public method

Test many different scenarios with self referential many-to-many relations.
public testSelfReferentialCRUD ( ) : void
return void

testUnique() public method

Just want to make sure it is not too limiting and functions properly for typical RedBeanPHP usage.
public testUnique ( ) : void
return void