Fixed JSON controller tests.

This commit is contained in:
James Cole 2015-05-02 23:39:39 +02:00
parent 06c6d6096f
commit 26079622f9
2 changed files with 33 additions and 0 deletions

View File

@ -132,6 +132,24 @@ class JsonControllerTest extends TestCase
$this->assertResponseOk(); $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() public function testExpenseAccounts()
{ {
$account = FactoryMuffin::create('FireflyIII\Models\Account'); $account = FactoryMuffin::create('FireflyIII\Models\Account');

View File

@ -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( FactoryMuffin::define(
'FireflyIII\Models\Budget', 'FireflyIII\Models\Budget',
[ [