|
@@ 47-70 (lines=24) @@
|
| 44 |
|
$this->assertContains("Round time #1 has one or more missing fields.", $result->errors); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testRoundTimeSecondsArePositiveNumbers() { |
| 48 |
|
$this->roundTimeCreateModel->isRoundTimesEnabled = true; |
| 49 |
|
|
| 50 |
|
$roundTime1 = new RoundTime(); |
| 51 |
|
$roundTime1->draft_id = 1; |
| 52 |
|
$roundTime1->round_time_seconds = -5; |
| 53 |
|
$roundTime1->is_static_time = false; |
| 54 |
|
$roundTime1->draft_round = 1; |
| 55 |
|
|
| 56 |
|
$roundTime2 = new RoundTime(); |
| 57 |
|
$roundTime2->draft_id = 1; |
| 58 |
|
$roundTime2->round_time_seconds = "q"; |
| 59 |
|
$roundTime2->is_static_time = false; |
| 60 |
|
$roundTime2->draft_round = 1; |
| 61 |
|
|
| 62 |
|
$this->roundTimeCreateModel->roundTimes[] = $roundTime1; |
| 63 |
|
$this->roundTimeCreateModel->roundTimes[] = $roundTime2; |
| 64 |
|
|
| 65 |
|
$result = $this->sut->AreRoundTimesValid($this->roundTimeCreateModel); |
| 66 |
|
|
| 67 |
|
$this->assertFalse($result->success); |
| 68 |
|
$this->assertContains("Round time #1 must have 1 or more seconds specified.", $result->errors); |
| 69 |
|
$this->assertContains("Round time #2 must have 1 or more seconds specified.", $result->errors); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
public function testEnsureRoundNumberIsCorrect() { |
| 73 |
|
$this->roundTimeCreateModel->isRoundTimesEnabled = true; |
|
@@ 72-95 (lines=24) @@
|
| 69 |
|
$this->assertContains("Round time #2 must have 1 or more seconds specified.", $result->errors); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
public function testEnsureRoundNumberIsCorrect() { |
| 73 |
|
$this->roundTimeCreateModel->isRoundTimesEnabled = true; |
| 74 |
|
|
| 75 |
|
$roundTime1 = new RoundTime(); |
| 76 |
|
$roundTime1->draft_id = 1; |
| 77 |
|
$roundTime1->round_time_seconds = -5; |
| 78 |
|
$roundTime1->is_static_time = false; |
| 79 |
|
$roundTime1->draft_round = 0; |
| 80 |
|
|
| 81 |
|
$roundTime2 = new RoundTime(); |
| 82 |
|
$roundTime2->draft_id = 1; |
| 83 |
|
$roundTime2->round_time_seconds = "q"; |
| 84 |
|
$roundTime2->is_static_time = false; |
| 85 |
|
$roundTime2->draft_round = 31; |
| 86 |
|
|
| 87 |
|
$this->roundTimeCreateModel->roundTimes[] = $roundTime1; |
| 88 |
|
$this->roundTimeCreateModel->roundTimes[] = $roundTime2; |
| 89 |
|
|
| 90 |
|
$result = $this->sut->AreRoundTimesValid($this->roundTimeCreateModel); |
| 91 |
|
|
| 92 |
|
$this->assertFalse($result->success); |
| 93 |
|
$this->assertContains("Round time #1 cannot have a round less than 1 or greater than 30.", $result->errors); |
| 94 |
|
$this->assertContains("Round time #2 cannot have a round less than 1 or greater than 30.", $result->errors); |
| 95 |
|
} |
| 96 |
|
} |