Improve test coverage.

This commit is contained in:
James Cole
2019-07-25 14:19:49 +02:00
parent ee95606ec0
commit 6ff4a0b45c
61 changed files with 822 additions and 599 deletions

View File

@@ -86,6 +86,7 @@ class Note extends Model
/**
* @param $value
* @codeCoverageIgnore
*/
public function setTextAttribute($value): void
{

View File

@@ -38,7 +38,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $id
* @property User user
* @property int $user_id
* @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Preference newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Preference newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Preference query()

View File

@@ -147,6 +147,7 @@ class Rule extends Model
/**
* @param $value
* @codeCoverageIgnore
*/
public function setDescriptionAttribute($value): void
{

View File

@@ -102,10 +102,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon updated_at
* @property string foreign_currency_code
* @SuppressWarnings (PHPMD.TooManyPublicMethods)
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property bool $reconciled
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Transaction after(\Carbon\Carbon $date)
@@ -185,30 +182,6 @@ class Transaction extends Model
return false;
}
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
*
* @param string $value
*
* @return Transaction
* @throws NotFoundHttpException
*/
public static function routeBinder(string $value): Transaction
{
if (auth()->check()) {
$transactionId = (int)$value;
/** @var User $user */
$user = auth()->user();
/** @var Transaction $transaction */
$transaction = $user->transactions()->where('transactions.id', $transactionId)->first(['transactions.*']);
if (null !== $transaction) {
return $transaction;
}
}
throw new NotFoundHttpException;
}
/**
* Get the account this object belongs to.