Covered currency repository.

This commit is contained in:
James Cole 2015-05-09 15:11:12 +02:00
parent 2cd5dae8e2
commit 506ef7b0b9

View File

@ -1,5 +1,6 @@
<?php <?php
use FireflyIII\Repositories\Currency\CurrencyRepository; use FireflyIII\Repositories\Currency\CurrencyRepository;
use League\FactoryMuffin\Facade as FactoryMuffin;
/** /**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-05 at 19:19:32. * 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 * @covers FireflyIII\Repositories\Currency\CurrencyRepository::countJournals
* @todo Implement testCountJournals().
*/ */
public function testCountJournals() public function testCountJournals()
{ {
// Remove the following lines when you implement this test. $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->markTestIncomplete( $count = $this->object->countJournals($currency);
'This test has not been implemented yet.' $this->assertEquals(0, $count);
);
} }
/** /**
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::get * @covers FireflyIII\Repositories\Currency\CurrencyRepository::get
* @todo Implement testGet().
*/ */
public function testGet() public function testGet()
{ {
// Remove the following lines when you implement this test. FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->markTestIncomplete( FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
'This test has not been implemented yet.'
); $set = $this->object->get();
$this->assertCount(2, $set);
} }
/** /**
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::getCurrencyByPreference * @covers FireflyIII\Repositories\Currency\CurrencyRepository::getCurrencyByPreference
* @todo Implement testGetCurrencyByPreference().
*/ */
public function testGetCurrencyByPreference() public function testGetCurrencyByPreference()
{ {
// Remove the following lines when you implement this test. $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->markTestIncomplete( $preference = FactoryMuffin::create('FireflyIII\Models\Preference');
'This test has not been implemented yet.' $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 * @covers FireflyIII\Repositories\Currency\CurrencyRepository::store
* @todo Implement testStore().
*/ */
public function testStore() public function testStore()
{ {
// Remove the following lines when you implement this test. $data = [
$this->markTestIncomplete( 'name' => 'Some Currency',
'This test has not been implemented yet.' 'code' => 'ABC',
); 'symbol' => 'S'
];
$currency = $this->object->store($data);
$this->assertEquals($data['name'], $currency->name);
} }
/** /**
* @covers FireflyIII\Repositories\Currency\CurrencyRepository::update * @covers FireflyIII\Repositories\Currency\CurrencyRepository::update
* @todo Implement testUpdate().
*/ */
public function testUpdate() public function testUpdate()
{ {
// Remove the following lines when you implement this test. $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$this->markTestIncomplete(
'This test has not been implemented yet.' $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);
} }
} }