From 26079622f9d19b20f71e9418d5edf54ca6d22df0 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 2 May 2015 23:39:39 +0200 Subject: [PATCH] Fixed JSON controller tests. --- tests/controllers/JsonControllerTest.php | 18 ++++++++++++++++++ tests/factories/all.php | 15 +++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/tests/controllers/JsonControllerTest.php b/tests/controllers/JsonControllerTest.php index 32f320161c..e8dd10ae38 100644 --- a/tests/controllers/JsonControllerTest.php +++ b/tests/controllers/JsonControllerTest.php @@ -132,6 +132,24 @@ class JsonControllerTest extends TestCase $this->assertResponseOk(); } + public function testTags() + { + $user = FactoryMuffin::create('FireflyIII\User'); + $this->be($user); + $tag = FactoryMuffin::create('FireflyIII\Models\Tag'); + $tag->user()->associate($user); + + $tag->save(); + $this->be($tag->user); + $tags = new Collection([$tag]); + + $repository = $this->mock('FireflyIII\Repositories\Tag\TagRepositoryInterface'); + $repository->shouldReceive('get')->andReturn($tags); + + $this->call('GET', '/json/tags'); + $this->assertResponseOk(); + } + public function testExpenseAccounts() { $account = FactoryMuffin::create('FireflyIII\Models\Account'); diff --git a/tests/factories/all.php b/tests/factories/all.php index 0a6d507a1a..85e4683a13 100644 --- a/tests/factories/all.php +++ b/tests/factories/all.php @@ -66,6 +66,21 @@ FactoryMuffin::define( ] ); +FactoryMuffin::define( + 'FireflyIII\Models\Tag', + [ + 'description' => 'sentence', + 'user_id' => 'factory|FireflyIII\User', + 'tag' => function () { + return RandomString::generateRandomString(20); + }, + 'tagMode' => 'nothing', + 'date' => 'date', + 'latitude' => 12, + 'longitude' => 13, + ] +); + FactoryMuffin::define( 'FireflyIII\Models\Budget', [