Fix test coverage.

This commit is contained in:
James Cole
2018-12-09 20:54:11 +01:00
parent 97f6e68164
commit ae4612f134
46 changed files with 383 additions and 229 deletions

View File

@@ -66,16 +66,6 @@ class PreferencesControllerTest extends TestCase
$response->assertStatus(200);
}
public function testShow(): void
{
/** @var Preference $preference */
$preference = $this->user()->preferences()->first();
$response = $this->get('/api/v1/preferences/' . $preference->id);
$response->assertStatus(200);
$response->assertSee($preference->name);
}
/**
* @covers \FireflyIII\Api\V1\Controllers\PreferenceController
* @covers \FireflyIII\Api\V1\Requests\PreferenceRequest
@@ -85,7 +75,7 @@ class PreferencesControllerTest extends TestCase
/** @var Preference $preference */
$preference = Preferences::setForUser($this->user(), 'frontPageAccounts', [1, 2, 3]);
$data = ['data' => '4,5,6'];
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
$response->assertSee($preference->name);
$response->assertStatus(200);
@@ -100,7 +90,7 @@ class PreferencesControllerTest extends TestCase
/** @var Preference $preference */
$preference = Preferences::setForUser($this->user(), 'twoFactorAuthEnabled', false);
$data = ['data' => '1'];
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
$response->assertSee($preference->name);
$response->assertStatus(200);
@@ -115,7 +105,7 @@ class PreferencesControllerTest extends TestCase
/** @var Preference $preference */
$preference = Preferences::setForUser($this->user(), 'currencyPreference', false);
$data = ['data' => 'EUR'];
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
$response->assertSee($preference->name);
$response->assertStatus(200);
@@ -130,7 +120,7 @@ class PreferencesControllerTest extends TestCase
/** @var Preference $preference */
$preference = Preferences::setForUser($this->user(), 'listPageSize', 13);
$data = ['data' => '434'];
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
$response->assertSee($preference->name);
$response->assertStatus(200);