Code cleanup

This commit is contained in:
James Cole
2015-05-17 11:28:58 +02:00
parent 6280448dfb
commit 033f5b67db
18 changed files with 96 additions and 51 deletions

View File

@@ -5,6 +5,7 @@ use Illuminate\Support\Collection;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* @SuppressWarnings(PHPMD.TooManyMethods)
* Class BudgetControllerTest
*/
class BudgetControllerTest extends TestCase

View File

@@ -6,6 +6,7 @@ use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* @SuppressWarnings(PHPMD.TooManyMethods)
* Class CategoryControllerTest
*/
class CategoryControllerTest extends TestCase

View File

@@ -3,6 +3,7 @@ use Illuminate\Support\Collection;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* @SuppressWarnings(PHPMD.TooManyMethods)
* Class CurrencyControllerTest
*/
class CurrencyControllerTest extends TestCase

View File

@@ -40,8 +40,8 @@ class JsonControllerTest extends TestCase
public function testBoxBillsPaid()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$cc = FactoryMuffin::create('FireflyIII\Models\Account');
$ccs = new Collection([$cc]);
$creditCard = FactoryMuffin::create('FireflyIII\Models\Account');
$ccs = new Collection([$creditCard]);
$collection = new Collection([$bill]);
$ranges = [['start' => new Carbon, 'end' => new Carbon]];
$this->be($bill->user);
@@ -69,8 +69,8 @@ class JsonControllerTest extends TestCase
public function testBoxBillsUnpaid()
{
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$cc = FactoryMuffin::create('FireflyIII\Models\Account');
$ccs = new Collection([$cc]);
$creditCard = FactoryMuffin::create('FireflyIII\Models\Account');
$ccs = new Collection([$creditCard]);
$collection = new Collection([$bill]);
$ranges = [['start' => new Carbon, 'end' => new Carbon]];
$this->be($bill->user);
@@ -133,24 +133,6 @@ class JsonControllerTest extends TestCase
$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()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
@@ -177,6 +159,24 @@ class JsonControllerTest extends TestCase
$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 testTransactionJournals()
{
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');

View File

@@ -8,6 +8,7 @@ use Illuminate\Support\Collection;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* @SuppressWarnings(PHPMD.TooManyMethods)
* Class PiggyBankControllerTest
*/
class PiggyBankControllerTest extends TestCase

View File

@@ -69,7 +69,7 @@ class ReportControllerTest extends TestCase
public function testMonth()
{
$user = FactoryMuffin::create('FireflyIII\User');
$account = FactoryMuffin::create('FireflyIII\Models\Account');
FactoryMuffin::create('FireflyIII\Models\Account');
$budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
$budget1->queryAmount = 12;
$budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
@@ -95,7 +95,7 @@ class ReportControllerTest extends TestCase
public function testMonthShared()
{
$user = FactoryMuffin::create('FireflyIII\User');
$account = FactoryMuffin::create('FireflyIII\Models\Account');
FactoryMuffin::create('FireflyIII\Models\Account');
$budget1 = FactoryMuffin::create('FireflyIII\Models\Budget');
$budget1->queryAmount = 12;
$budget2 = FactoryMuffin::create('FireflyIII\Models\Budget');
@@ -132,7 +132,7 @@ class ReportControllerTest extends TestCase
'data' => 'sharedAsset'
]
);
$journals = new Collection([$journal]);
new Collection([$journal]);
$this->be($user);

View File

@@ -2,6 +2,7 @@
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* @SuppressWarnings(PHPMD.TooManyMethods)
* Class TagControllerTest
*/
class TagControllerTest extends TestCase

View File

@@ -4,6 +4,7 @@ use Illuminate\Support\Collection;
use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* @SuppressWarnings(PHPMD.TooManyMethods)
* Class TransactionControllerTest
*/
class TransactionControllerTest extends TestCase
@@ -82,6 +83,9 @@ class TransactionControllerTest extends TestCase
}
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testEdit()
{
// make complete journal:
@@ -225,6 +229,9 @@ class TransactionControllerTest extends TestCase
$this->assertResponseOk();
}
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testStore()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
@@ -269,6 +276,9 @@ class TransactionControllerTest extends TestCase
}
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testUpdate()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
@@ -314,6 +324,9 @@ class TransactionControllerTest extends TestCase
}
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testUpdateWithRedirect()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');