the browser-facing portion of osu!
at master 30 lines 762 B view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6declare(strict_types=1); 7 8namespace Tests; 9 10use App\Models\Group; 11use Database\Seeders\ModelSeeders\GroupSeeder; 12use PHPUnit\Runner\AfterLastTestHook; 13use PHPUnit\Runner\BeforeFirstTestHook; 14 15class SeederExtension implements AfterLastTestHook, BeforeFirstTestHook 16{ 17 public function executeAfterLastTest(): void 18 { 19 TestCase::withDbAccess(function () { 20 Group::truncate(); 21 }); 22 } 23 24 public function executeBeforeFirstTest(): void 25 { 26 TestCase::withDbAccess(function () { 27 (new GroupSeeder())->run(); 28 }); 29 } 30}