the browser-facing portion of osu!
at master 1.1 kB 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 6namespace Tests\Models\Score; 7 8use App\Exceptions\ClassNotFoundException; 9use App\Models\Beatmap; 10use App\Models\Score\Model; 11use Tests\TestCase; 12 13class ModelTest extends TestCase 14{ 15 public function testGetClass(): void 16 { 17 foreach (Beatmap::MODES as $ruleset => $_rulesetId) { 18 $class = Model::getClass($ruleset); 19 $this->assertInstanceOf(Model::class, new $class()); 20 } 21 } 22 23 /** 24 * @dataProvider dataProviderForTestGetClassInvalidRuleset 25 */ 26 public function testGetClassInvalidRuleset(string $ruleset) 27 { 28 $this->expectException(ClassNotFoundException::class); 29 Model::getClass($ruleset); 30 } 31 32 public static function dataProviderForTestGetClassInvalidRuleset(): array 33 { 34 return [ 35 ['does'], 36 ['not exist'], 37 ['not_real'], 38 ['best\\_osu'], 39 ]; 40 } 41}