/** * @covers BBTournament::save_matches */ public function test_save_matches_without_report() { $this->get_tournament_with_open_matches(); $match1 = $this->object->open_matches[0]; $match2 = $this->object->open_matches[2]; $match3 = $this->object->open_matches[3]; //report the first match - leave 2 and 3 alone $match1->set_winner($match1->team2()); $this->assertSave($match1->report()); //update the notes for first 2 matches $match1->notes = 'updated notes for match 1'; $match2->notes = 'updated notes for match 2'; //Now set the winners for the second 2 matches - but they should never be reported $match2->set_winner($match2->team()); $match3->set_winner($match2->team()); //Update matches without reporting $this->assertSave($this->object->save_matches(false)); //Match 1 should have an id, but not the second 2 $this->assertID($match1->id); $this->assertNull($match2->id); $this->assertNull($match3->id); //Externally verify notes updated on match 1 $this->AssertMatchValueExternally($match1, 'notes', 'updated notes for match 1'); }