Stash old tests
This commit is contained in:
parent
e0c3a26411
commit
b32ade6c7f
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Actions\Entries;
|
||||
|
||||
use App\Exceptions\AuditionAdminException;
|
||||
use App\Exceptions\ManageEntryException;
|
||||
use App\Models\Audition;
|
||||
use App\Models\AuditLogEntry;
|
||||
|
|
@ -83,29 +84,29 @@ class CreateEntry
|
|||
{
|
||||
// Make sure it's a valid student
|
||||
if (! $student || ! $student->exists()) {
|
||||
throw new ManageEntryException('Invalid student provided');
|
||||
throw new AuditionAdminException('Invalid student provided');
|
||||
}
|
||||
// Make sure the audition is valid
|
||||
if (! $audition || ! $audition->exists()) {
|
||||
throw new ManageEntryException('Invalid audition provided');
|
||||
throw new AuditionAdminException('Invalid audition provided');
|
||||
}
|
||||
// A student can't enter the same audition twice
|
||||
if (Entry::where('student_id', $student->id)->where('audition_id', $audition->id)->exists()) {
|
||||
throw new ManageEntryException('That student is already entered in that audition');
|
||||
throw new AuditionAdminException('That student is already entered in that audition');
|
||||
}
|
||||
// Can't enter a published audition
|
||||
if ($audition->hasFlag('seats_published')) {
|
||||
throw new ManageEntryException('Cannot add an entry to an audition where seats are published');
|
||||
throw new AuditionAdminException('Cannot add an entry to an audition where seats are published');
|
||||
}
|
||||
if ($audition->hasFlag('advancement_published')) {
|
||||
throw new ManageEntryException('Cannot add an entry to an audition where advancement is published');
|
||||
throw new AuditionAdminException('Cannot add an entry to an audition where advancement is published');
|
||||
}
|
||||
// Verify the grade of the student is in range for the audition
|
||||
if ($student->grade > $audition->maximum_grade) {
|
||||
throw new ManageEntryException('The grade of the student exceeds the maximum for that audition');
|
||||
throw new AuditionAdminException('The grade of the student exceeds the maximum for that audition');
|
||||
}
|
||||
if ($student->grade < $audition->minimum_grade) {
|
||||
throw new ManageEntryException('The grade of the student does not meet the minimum for that audition');
|
||||
throw new AuditionAdminException('The grade of the student does not meet the minimum for that audition');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Actions\Entries\CreateEntry;
|
||||
use App\Exceptions\ManageEntryException;
|
||||
use App\Exceptions\AuditionAdminException;
|
||||
use App\Models\Audition;
|
||||
use App\Models\AuditLogEntry;
|
||||
use App\Models\Entry;
|
||||
|
|
@ -57,7 +57,7 @@ class EntryController extends Controller
|
|||
|
||||
try {
|
||||
$creator($validData['student_id'], $validData['audition_id'], $enter_for);
|
||||
} catch (ManageEntryException $ex) {
|
||||
} catch (AuditionAdminException $ex) {
|
||||
return redirect()->route('entries.index')->with('error', $ex->getMessage());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ use Illuminate\Support\Facades\App;
|
|||
uses(RefreshDatabase::class);
|
||||
|
||||
it('throws an exception if mode is not seating or advancement', function () {
|
||||
#$calculator = new AllJudgesCount();
|
||||
//$calculator = new AllJudgesCount();
|
||||
$calculator = App::make(AllowForOlympicScoring::class);
|
||||
$calculator->calculate('WRONG', Entry::factory()->create());
|
||||
})->throws(TabulationException::class, 'Mode must be seating or advancement');
|
||||
|
||||
it('throws an exception if entry is not valid', function () {
|
||||
// Arrange
|
||||
#$calculator = new AllJudgesCount();
|
||||
//$calculator = new AllJudgesCount();
|
||||
$calculator = App::make(AllowForOlympicScoring::class);
|
||||
// Act
|
||||
$calculator->calculate('seating', Entry::factory()->make());
|
||||
|
|
@ -41,7 +41,7 @@ it('throws an exception if entry is missing judge scores', function () {
|
|||
1004 => 80,
|
||||
1005 => 90,
|
||||
];
|
||||
#$calculator = new AllJudgesCount();
|
||||
//$calculator = new AllJudgesCount();
|
||||
$calculator = App::make(AllowForOlympicScoring::class);
|
||||
enterScore($judge1, $entry, $scores);
|
||||
// Act
|
||||
|
|
@ -65,7 +65,7 @@ it('throws an exception if a score exists from an invalid judge', function () {
|
|||
1004 => 80,
|
||||
1005 => 90,
|
||||
];
|
||||
#$calculator = new AllJudgesCount();
|
||||
//$calculator = new AllJudgesCount();
|
||||
$calculator = App::make(AllowForOlympicScoring::class);
|
||||
enterScore($judge1, $entry, $scores);
|
||||
$scoreSheetToSpoof = enterScore($judge2, $entry, $scores);
|
||||
|
|
@ -97,7 +97,7 @@ it('correctly calculates scores for seating', function () {
|
|||
1004 => 85,
|
||||
1005 => 95,
|
||||
];
|
||||
#$calculator = new AllJudgesCount();
|
||||
//$calculator = new AllJudgesCount();
|
||||
$calculator = App::make(AllowForOlympicScoring::class);
|
||||
enterScore($judge1, $entry, $scores);
|
||||
enterScore($judge2, $entry, $scores2);
|
||||
|
|
@ -12,7 +12,6 @@ use Illuminate\Support\Facades\Artisan;
|
|||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
|
||||
it('throws an exception if an invalid mode is called for', function () {
|
||||
$calculator = app(CalculateScoreSheetTotal::class);
|
||||
$calculator('anything', Entry::factory()->create(), User::factory()->create());
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
use App\Actions\Tabulation\AllowForOlympicScoring;
|
||||
use App\Actions\Tabulation\RankAuditionEntries;
|
||||
use App\Exceptions\TabulationException;
|
||||
use App\Models\Audition;
|
||||
|
|
@ -14,13 +13,13 @@ use Illuminate\Support\Facades\Artisan;
|
|||
uses(RefreshDatabase::class);
|
||||
|
||||
it('throws an exception if an invalid mode is specified', function () {
|
||||
#$ranker = new RankAuditionEntries(new AllJudgesCount());
|
||||
//$ranker = new RankAuditionEntries(new AllJudgesCount());
|
||||
$ranker = App::make(RankAuditionEntries::class);
|
||||
$ranker->rank('wrong', Audition::factory()->create());
|
||||
})->throws(TabulationException::class, 'Mode must be seating or advancement');
|
||||
it('throws an exception if an invalid audition is provided', function () {
|
||||
// Arrange
|
||||
#$ranker = new RankAuditionEntries(new AllJudgesCount());
|
||||
//$ranker = new RankAuditionEntries(new AllJudgesCount());
|
||||
$ranker = App::make(RankAuditionEntries::class);
|
||||
// Act & Assert
|
||||
$ranker->rank('seating', Audition::factory()->make());
|
||||
|
|
@ -29,7 +28,7 @@ it('includes all entries of the given mode in the return', function () {
|
|||
$audition = Audition::factory()->create();
|
||||
$entries = Entry::factory()->seatingOnly()->count(10)->create(['audition_id' => $audition->id]);
|
||||
$otherEntries = Entry::factory()->advanceOnly()->count(10)->create(['audition_id' => $audition->id]);
|
||||
#$ranker = new RankAuditionEntries(new AllJudgesCount());
|
||||
//$ranker = new RankAuditionEntries(new AllJudgesCount());
|
||||
$ranker = App::make(RankAuditionEntries::class);
|
||||
// Act
|
||||
$return = $ranker->rank('seating', $audition);
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
use function Pest\Laravel\actingAs;
|
||||
use function Pest\Laravel\get;
|
||||
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
use App\Models\School;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
use function Pest\Laravel\actingAs;
|
||||
use function Pest\Laravel\get;
|
||||
use function Pest\Laravel\post;
|
||||
|
|
@ -4,12 +4,11 @@ use App\Models\Entry;
|
|||
use App\Models\School;
|
||||
use App\Models\Student;
|
||||
use App\Models\User;
|
||||
use App\Services\EntryService;
|
||||
use App\Services\Invoice\InvoiceOneFeePerEntry;
|
||||
use App\Settings;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
use function Pest\Laravel\actingAs;
|
||||
use function Pest\Laravel\get;
|
||||
|
||||
|
|
@ -65,7 +64,7 @@ it('has a new school link', function () {
|
|||
});
|
||||
it('shows school data', function () {
|
||||
// Arrange
|
||||
#$invoiceDataService = new App\Services\Invoice\InvoiceOneFeePerEntry(new App\Services\EntryService(new App\Services\AuditionService()));
|
||||
//$invoiceDataService = new App\Services\Invoice\InvoiceOneFeePerEntry(new App\Services\EntryService(new App\Services\AuditionService()));
|
||||
$invoiceDataService = App::make(InvoiceOneFeePerEntry::class);
|
||||
Settings::set('school_fees', 1000);
|
||||
Settings::set('late_fee', 2500);
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Entry;
|
||||
use App\Models\School;
|
||||
use App\Models\SchoolEmailDomain;
|
||||
use App\Models\Student;
|
||||
|
|
@ -4,6 +4,7 @@ use App\Models\School;
|
|||
use App\Models\Student;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
use function Pest\Laravel\actingAs;
|
||||
use function Pest\Laravel\get;
|
||||
use function Pest\Laravel\post;
|
||||
|
|
@ -11,6 +11,7 @@ use App\Settings;
|
|||
use Database\Seeders\ScoreAllAuditions;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
use function Pest\Laravel\actingAs;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
use App\Models\Audition;
|
||||
use App\Models\Entry;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ it('sets the draw_number column on each entry in the audition based on the rando
|
|||
// Arrange
|
||||
$audition = Audition::factory()->hasEntries(10)->create();
|
||||
Entry::all()->each(fn ($entry) => expect($entry->draw_number)->toBeNull());
|
||||
#$drawService = new DrawService();
|
||||
//$drawService = new DrawService();
|
||||
$drawService = App::make(DrawService::class);
|
||||
$drawService->runOneDraw($audition);
|
||||
// Act & Assert
|
||||
|
|
@ -88,7 +88,7 @@ it('only sets draw numbers in the specified audition', function () {
|
|||
// Arrange
|
||||
$audition = Audition::factory()->hasEntries(10)->create();
|
||||
$bonusEntry = Entry::factory()->create();
|
||||
#$drawService = new DrawService();
|
||||
//$drawService = new DrawService();
|
||||
$drawService = App::make(DrawService::class);
|
||||
$drawService->runOneDraw($audition);
|
||||
// Act & Assert
|
||||
|
|
@ -12,7 +12,7 @@ use Illuminate\Support\Facades\App;
|
|||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
#$this->scoreService = new ScoreService();
|
||||
//$this->scoreService = new ScoreService();
|
||||
$this->scoreService = App::make(ScoreService::class);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue