Tweak tests

This commit is contained in:
Pig Fang 2019-04-06 23:16:14 +08:00
parent 8fa1477d7d
commit 298b6edf66
4 changed files with 11 additions and 2 deletions

View File

@ -9,7 +9,7 @@ class CheckInstallation
public function handle($request, \Closure $next) public function handle($request, \Closure $next)
{ {
if (env('DB_CONNECTION') == 'dummy') { if (env('DB_CONNECTION') == 'dummy') {
return $next($request); return $next($request); // @codeCoverageIgnore
} }
if (SetupController::checkTablesExist()) { if (SetupController::checkTablesExist()) {

View File

@ -32,9 +32,11 @@ class CheckPlayerExist
$responses = event(new CheckPlayerExists($player_name)); $responses = event(new CheckPlayerExists($player_name));
foreach ($responses as $r) { foreach ($responses as $r) {
// @codeCoverageIgnoreStart
if ($r) { if ($r) {
return $next($request); return $next($request);
} // @codeCoverageIgnore }
// @codeCoverageIgnoreEnd
} }
if (! Player::where('name', $player_name)->get()->isEmpty()) { if (! Player::where('name', $player_name)->get()->isEmpty()) {

View File

@ -129,6 +129,8 @@ class AdminControllerTest extends BrowserKitTestCase
->type('/^([0-9]+)$/', 'custom_player_name_regexp') ->type('/^([0-9]+)$/', 'custom_player_name_regexp')
->select('1', 'api_type') ->select('1', 'api_type')
->check('auto_del_invalid_texture') ->check('auto_del_invalid_texture')
->uncheck('allow_downloading_texture')
->type('abc', 'texture_name_regexp')
->type('policy', 'content_policy') ->type('policy', 'content_policy')
->type('code', 'comment_script') ->type('code', 'comment_script')
->press('submit_general'); ->press('submit_general');
@ -143,6 +145,8 @@ class AdminControllerTest extends BrowserKitTestCase
$this->assertEquals('/^([0-9]+)$/', option('custom_player_name_regexp')); $this->assertEquals('/^([0-9]+)$/', option('custom_player_name_regexp'));
$this->assertEquals('1', option('api_type')); $this->assertEquals('1', option('api_type'));
$this->assertTrue(option('auto_del_invalid_texture')); $this->assertTrue(option('auto_del_invalid_texture'));
$this->assertFalse(option('allow_downloading_texture'));
$this->assertEquals('abc', option('texture_name_regexp'));
$this->assertEquals('policy', option_localized('content_policy')); $this->assertEquals('policy', option_localized('content_policy'));
$this->assertEquals('code', option('comment_script')); $this->assertEquals('code', option('comment_script'));

View File

@ -358,6 +358,9 @@ class SkinlibControllerTest extends TestCase
->get('/skinlib/upload') ->get('/skinlib/upload')
->assertViewHas('user') ->assertViewHas('user')
->assertViewHas('with_out_filter', true); ->assertViewHas('with_out_filter', true);
option(['texture_name_regexp' => 'abc']);
$this->get('/skinlib/upload')->assertViewHas('extra');
} }
public function testHandleUpload() public function testHandleUpload()