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', [