From cf03da0a2e41e5047c4311045202cff619c74322 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Sun, 19 Aug 2018 18:28:38 +0800 Subject: [PATCH] Update tests --- app/Http/Controllers/PluginController.php | 3 --- tests/AuthControllerTest.php | 6 +++--- tests/MarketControllerTest.php | 22 ++++------------------ 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/app/Http/Controllers/PluginController.php b/app/Http/Controllers/PluginController.php index fbc69dce..56d2e940 100644 --- a/app/Http/Controllers/PluginController.php +++ b/app/Http/Controllers/PluginController.php @@ -55,9 +55,6 @@ class PluginController extends Controller return json(trans('admin.plugins.operations.enabled', ['plugin' => $plugin->title]), 0); - case 'requirements': - return json($this->getPluginDependencies($plugin)); - case 'disable': $plugins->disable($name); diff --git a/tests/AuthControllerTest.php b/tests/AuthControllerTest.php index 757a19cd..e717e58f 100644 --- a/tests/AuthControllerTest.php +++ b/tests/AuthControllerTest.php @@ -436,16 +436,16 @@ class AuthControllerTest extends TestCase $this->assertAuthenticated(); // Require player name - option(['register_with_player_name' => false]); + option(['register_with_player_name' => true]); $this->postJson( '/auth/register', [ - 'email' => 'a@b.c', + 'email' => 'abc@test.org', 'password' => '12345678', 'player_name' => 'name', 'captcha' => 'a' ] - ); + )->assertJson(['errno' => 0]); $this->assertNotNull(Player::where('player_name', 'name')); } diff --git a/tests/MarketControllerTest.php b/tests/MarketControllerTest.php index e4519014..d7cfc41a 100644 --- a/tests/MarketControllerTest.php +++ b/tests/MarketControllerTest.php @@ -143,9 +143,12 @@ class MarketControllerTest extends TestCase public function testMarketData() { + $registry = $this->generateFakePluginsRegistry(); + $package = json_decode($registry, true)['packages'][0]; + $this->generateFakePlugin($package); $this->setupGuzzleClientMock([ new RequestException('Connection Error', new Request('POST', 'whatever')), - new Response(200, [], $this->generateFakePluginsRegistry()), + new Response(200, [], $registry), ]); // Expected an exception, but unable to be asserted. @@ -164,23 +167,6 @@ class MarketControllerTest extends TestCase 'dependencies' ] ]); - - // Detect installed plugins - $this->appendToGuzzleQueue(200, [], $this->generateFakePluginsRegistry('fake', '0.0.1')); - $this->generateFakePlugin(['name' => 'fake', 'version' => '0.0.1']); - $this->getJson('/admin/plugins/market-data') - ->assertJsonStructure([ - [ - 'name', - 'title', - 'version', - 'installed', - 'description', - 'author', - 'dist', - 'dependencies' - ] - ]); } protected function tearDown()