Should cover models.

This commit is contained in:
James Cole
2015-05-24 11:13:46 +02:00
parent 8f2f912cdf
commit 6c71f68ed8
9 changed files with 555 additions and 116 deletions

View File

@@ -1,5 +1,9 @@
<?php
use FireflyIII\Models\Category;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* Class CategoryModelTest
*/
@@ -40,7 +44,33 @@ class CategoryModelTest extends TestCase
*/
public function testFirstOrCreateEncrypted()
{
$this->markTestIncomplete();
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$search = [
'name' => $category->name,
'user_id' => $category->user_id
];
$result = Category::firstOrCreateEncrypted($search);
$this->assertEquals($result->id, $category->id);
}
/**
* @covers FireflyIII\Models\Category::firstOrCreateEncrypted
*/
public function testFirstOrCreateEncryptedNew()
{
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$search = [
'name' => 'Some category name',
'user_id' => $category->user_id
];
$result = Category::firstOrCreateEncrypted($search);
$this->assertNotEquals($result->id, $category->id);
}
}