Update tests

This commit is contained in:
Pig Fang 2018-08-19 18:28:38 +08:00
parent e6e989281c
commit cf03da0a2e
3 changed files with 7 additions and 24 deletions

View File

@ -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);

View File

@ -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'));
}

View File

@ -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()