Skip to content

Commit

Permalink
Fix tests (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 authored Oct 10, 2023
1 parent 8efe5b3 commit cfd85ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 2 additions & 3 deletions tests/Casts/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@
namespace OwenIt\Auditing\Tests\Casts;

use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Tests\Models\Money as MoneyValueObject;

class Money implements CastsAttributes
{
/**
* {@inheritdoc}
*/
public function get(Model $model, string $key, mixed $value, array $attributes): MoneyValueObject
public function get($model, string $key, $value, array $attributes)
{
return new MoneyValueObject($value, 'USD');
}

/**
* {@inheritdoc}
*/
public function set(Model $model, string $key, mixed $value, array $attributes): mixed
public function set($model, string $key, $value, array $attributes)
{
return $value;
}
Expand Down
16 changes: 9 additions & 7 deletions tests/Models/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@

final class Money
{
/**
* Formatted value.
*/
/** Formatted value. */
public string $formatted;
/** Value */
public string $amount;
/** Format */
public string $currency;

/**
* Create a new money instance.
*/
public function __construct(
public string $amount,
public string $currency,
) {
public function __construct(string $amount, string $currency)
{
$this->amount = $amount;
$this->currency = $currency;
$formatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY);

$this->formatted = $formatter->formatCurrency($this->amount, $this->currency);
Expand Down

0 comments on commit cfd85ad

Please sign in to comment.