Skip to content

Commit

Permalink
Install money formatter dependency, and add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Sep 27, 2021
1 parent 13634d9 commit 3c2843d
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"php": "^7.2|^8.0",
"illuminate/contracts": "^6.0 || ^7.0 || ^8.0",
"illuminate/database": "^6.0 || ^7.0 || ^8.40.0",
"illuminate/support": "^6.0 || ^7.0 || ^8.0"
"illuminate/support": "^6.0 || ^7.0 || ^8.0",
"akaunting/laravel-money": "^1.2"
},
"require-dev": {
"orchestra/testbench": "^6.2",
Expand Down
67 changes: 66 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions tests/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Squire\Tests;

use Illuminate\Support\Facades\App;
use Squire\Models\Currency;
use Squire\Repository;
use Squire\Tests\Models;

Expand Down Expand Up @@ -40,6 +41,13 @@ public function can_translate_models()
$this->assertEquals('es', Models\Foo::first()->lang);
}

/** @test */
public function can_format_usd()
{
$this->assertSame('$5.00', Currency::find('usd')->format(500));
$this->assertSame('$500.00', Currency::find('usd')->format(500, true));
}

protected function testModel($model)
{
$locales = array_keys(Repository::getSources($model));
Expand Down

0 comments on commit 3c2843d

Please sign in to comment.