/**
  * Tests removing a child with $preserve disabled, and checking to make sure
  *  that any references are set to null
  * 
  * @covers BBTournament::remove_child
  * @covers BBModel::remove_child
  * @group bbmodel
  */
 public function test_remove_child_unpreserved()
 {
     $this->get_tournament_inactive();
     $team =& $this->object->team();
     $this->assertTrue(in_array($team, $this->object->teams()));
     $this->assertTrue($this->object->remove_child($team, null, false));
     //
     $this->assertNull($team);
 }
 /**
  * Tests open_match by providing a match object
  * @covers BBTournament::open_match()
  */
 public function test_open_match_invalid_team_pair()
 {
     $this->get_tournament_with_open_matches();
     $match = $this->object->open_matches[0];
     $team1 = $match->team();
     $invalid_team = null;
     foreach ($this->object->teams() as $team) {
         if (!$match->team_in_match($team)) {
             $invalid_team = $team;
             break;
         }
     }
     $this->assertNull($this->object->open_match($team1, $invalid_team));
 }
 /**
  * Make sure that when loading teams, we send the "json_notes" argument, so that each team
  *  automtatically has a value for notes_decoded
  * 
  * @return LocalTeam[]
  */
 public function &teams($ids = false, $args = array())
 {
     return parent::teams($ids, array_merge($args, array('json_notes' => true)));
 }
 /**
  * Since PHP doesn't allow overloading the constructor with a different parameter list,
  * we'll simply use a pseudo-constructor and call it init()
  * 
  * @param BBTournament $tournament
  * @param boolean $add_to_parent        True by default, try to add ourselves to the parent BBTournament
  * @return void
  */
 public function init(BBTournament &$tournament, $add_to_parent = true)
 {
     $this->tournament =& $tournament;
     //Set parent so BBModel will auto flag changes
     $this->parent =& $this->tournament;
     //If not already being tracked, flag ourselves in the new tournament
     if ($add_to_parent) {
         if (is_array($teams =& $this->tournament->teams(false, null, true))) {
             if (!in_array($this, $teams)) {
                 $this->tournament->add_team($this);
             }
         }
     }
 }