RedUNIT\Base\Association::testCrossAssociation PHP Method

testCrossAssociation() public method

Test self-referential associations.
public testCrossAssociation ( ) : void
return void
    public function testCrossAssociation()
    {
        $ghost = R::dispense('ghost');
        $ghost2 = R::dispense('ghost');
        R::getRedBean()->getAssociationManager()->associate($ghost, $ghost2);
        \Model_Ghost_Ghost::$deleted = FALSE;
        R::getRedBean()->getAssociationManager()->unassociate($ghost, $ghost2);
        // No fast-track, assoc bean got trashed
        asrt(\Model_Ghost_Ghost::$deleted, TRUE);
        \Model_Ghost_Ghost::$deleted = FALSE;
        R::getRedBean()->getAssociationManager()->unassociate($ghost, $ghost2, TRUE);
        // Fast-track, assoc bean got deleted right away
        asrt(\Model_Ghost_Ghost::$deleted, FALSE);
    }