Exemplo n.º 1
0
 /**
  * Tests to make sure that the team and opponent's wins and lb_wins are updated
  *      after reporting a match
  */
 public function test_wins_after_report()
 {
     $this->set_object_with_open_match();
     //Make sure that $team wins, so his next match won't have an opponent yet
     $this->assertInstanceOf('BBMatch', $match = $this->object->match());
     $this->assertEquals($this->object->opponent(), $opponent =& $match->toggle_team($this->object));
     //Should start with no wins / lbwins
     $this->assertEquals(0, $this->object->wins);
     $this->assertEquals(-1, $this->object->lb_wins);
     $this->assertEquals(0, $opponent->wins);
     $this->assertEquals(-1, $opponent->lb_wins);
     //
     $this->assertTrue($match->set_winner($this->object));
     $this->assertSave($this->object->match->report());
     //opponent should have lb_wins now, and team should have wins
     $this->assertTrue($this->object->wins > 0);
     $this->assertEquals(-1, $this->object->lb_wins);
     $this->assertEquals(0, $opponent->wins);
     $this->assertTrue($opponent->lb_wins > -1);
 }