/** * Test unreport() on a match that is not allowed * to be unreported - because either team has * reported other wins since */ public function test_unreport_bracket_invalid() { $this->assertTrue($this->object->set_winner($this->object->team())); $this->assertSave($this->object->report()); //Game team() another win, but we may have to report other matches until he has an opponent while (is_null($this->object->winner->match())) { $this->assertInstanceOf('BBMatch', $match = $this->object->tournament->open_matches[0]); $this->assertTrue($match->set_winner($match->team2())); $this->assertSave($match->report()); } //should have an open match now - report it $this->assertInstanceOf('BBMatch', $match = $this->object->winner->match()); $this->assertTrue($match->set_winner($this->object->winner())); $this->assertSave($match->report()); //now that winner() has had reported beyond $this->object, we should no longer be allowed to unreport it $this->assertFalse($this->object->unreport()); }