mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Covered currency repository.
This commit is contained in:
parent
2cd5dae8e2
commit
506ef7b0b9
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepository;
|
||||
use League\FactoryMuffin\Facade as FactoryMuffin;
|
||||
|
||||
/**
|
||||
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 19:19:32.
|
||||
@ -32,61 +33,82 @@ class CurrencyRepositoryTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::countJournals
|
||||
* @todo Implement testCountJournals().
|
||||
*/
|
||||
public function testCountJournals()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
|
||||
$count = $this->object->countJournals($currency);
|
||||
$this->assertEquals(0, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::get
|
||||
* @todo Implement testGet().
|
||||
*/
|
||||
public function testGet()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
|
||||
FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
|
||||
|
||||
$set = $this->object->get();
|
||||
$this->assertCount(2, $set);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::getCurrencyByPreference
|
||||
* @todo Implement testGetCurrencyByPreference().
|
||||
*/
|
||||
public function testGetCurrencyByPreference()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
|
||||
$preference = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$preference->data = $currency->code;
|
||||
$preference->save();
|
||||
$found = $this->object->getCurrencyByPreference($preference);
|
||||
$this->assertEquals($currency->id, $found->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::getCurrencyByPreference
|
||||
*/
|
||||
public function testGetCurrencyByPreferenceNull()
|
||||
{
|
||||
$first = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
|
||||
$preference = FactoryMuffin::create('FireflyIII\Models\Preference');
|
||||
$preference->data = 'ABC';
|
||||
$preference->save();
|
||||
$found = $this->object->getCurrencyByPreference($preference);
|
||||
$this->assertEquals($first->id, $found->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::store
|
||||
* @todo Implement testStore().
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$data = [
|
||||
'name' => 'Some Currency',
|
||||
'code' => 'ABC',
|
||||
'symbol' => 'S'
|
||||
];
|
||||
|
||||
$currency = $this->object->store($data);
|
||||
$this->assertEquals($data['name'], $currency->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::update
|
||||
* @todo Implement testUpdate().
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
|
||||
|
||||
$data = [
|
||||
'name' => 'Some Currency',
|
||||
'code' => 'ABC',
|
||||
'symbol' => 'S'
|
||||
];
|
||||
|
||||
$newCurrency = $this->object->update($currency, $data);
|
||||
$this->assertEquals($data['name'], $newCurrency->name);
|
||||
$this->assertEquals($currency->id, $newCurrency->id);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user