Files
firefly-iii/tests/models/TagModelTest.php

78 lines
1.7 KiB
PHP
Raw Normal View History

2015-05-24 10:01:00 +02:00
<?php
2015-05-24 11:13:46 +02:00
use FireflyIII\Models\Tag;
use League\FactoryMuffin\Facade as FactoryMuffin;
2015-05-24 10:01:00 +02:00
/**
* Class TagModelTest
*/
class TagModelTest extends TestCase
{
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
parent::setUp();
}
/**
* This method is called before the first test of this test class is run.
*
* @since Method available since Release 3.4.0
*/
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
2015-05-24 11:13:46 +02:00
/**
* @covers FireflyIII\Models\Tag::firstOrCreateEncrypted
*/
2015-05-25 19:58:13 +02:00
public function testFirstOrCreateEncrypted()
2015-05-24 11:13:46 +02:00
{
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
$search = [
'tagMode' => 'something',
2015-05-25 19:58:13 +02:00
'tag' => $tag->tag,
2015-05-24 11:13:46 +02:00
'user_id' => $tag->user_id,
];
$result = Tag::firstOrCreateEncrypted($search);
2015-05-25 19:58:13 +02:00
$this->assertEquals($tag->id, $result->id);
2015-05-24 11:13:46 +02:00
}
2015-05-24 10:01:00 +02:00
/**
* @covers FireflyIII\Models\Tag::firstOrCreateEncrypted
*/
2015-05-25 19:58:13 +02:00
public function testFirstOrCreateEncryptedNew()
2015-05-24 10:01:00 +02:00
{
2015-05-24 11:13:46 +02:00
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
$search = [
'tagMode' => 'something',
2015-05-25 19:58:13 +02:00
'tag' => 'Something else',
2015-05-24 11:13:46 +02:00
'user_id' => $tag->user_id,
];
$result = Tag::firstOrCreateEncrypted($search);
2015-05-25 19:58:13 +02:00
$this->assertNotEquals($tag->id, $result->id);
2015-05-24 10:01:00 +02:00
}
2015-05-24 15:18:19 +02:00
}