Removed my own validation source in favour of Ardent.

This commit is contained in:
James Cole
2014-07-15 17:09:59 +02:00
parent a1fb4bdb60
commit aa36e8b7cf
17 changed files with 212 additions and 163 deletions

View File

@@ -1,5 +1,7 @@
<?php
use \League\FactoryMuffin\Facade\FactoryMuffin;
class ChartControllerTest extends TestCase
{
public function setUp()
@@ -51,21 +53,7 @@ class ChartControllerTest extends TestCase
public function testHomeAccountWithInput()
{
// save actual account:
$type = new AccountType;
$type->description = 'An account';
$type->save();
$user = new User;
$user->email = 'bla';
$user->migrated = false;
$user->password = 'bla';
$user->save();
$account = new Account;
$account->accountType()->associate($type);
$account->user()->associate($user);
$account->name = 'Hello';
$account->active = true;
$account->save();
$account = FactoryMuffin::create('Account');
// mock preference:
$pref = $this->mock('Preference');
@@ -83,54 +71,12 @@ class ChartControllerTest extends TestCase
$accounts = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
$accounts->shouldReceive('find')->with(1)->andReturn($account);
// call
$this->call('GET', '/chart/home/account/' . $account->id);
// test
$this->assertResponseOk();
}
public function testHomeAccountWithInvalidInput()
{
// save actual account:
$type = new AccountType;
$type->description = 'An account';
$type->save();
$user = new User;
$user->email = 'bla';
$user->migrated = false;
$user->password = 'bla';
$user->save();
$account = new Account;
$account->accountType()->associate($type);
$account->user()->associate($user);
$account->name = 'Hello';
$account->active = true;
$account->save();
// mock preference:
$pref = $this->mock('Preference');
$pref->shouldReceive('getAttribute', 'data')->andReturn('1M');
// mock preferences helper:
$preferences = $this->mock('Firefly\Helper\Preferences\PreferencesHelperInterface');
$preferences->shouldReceive('get')->with('viewRange', '1M')->once()->andReturn($pref);
// mock toolkit:
$toolkit = $this->mock('Firefly\Helper\Toolkit\ToolkitInterface');
$toolkit->shouldReceive('getDateRange')->andReturn(null);
// mock account repository:
$accounts = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
$accounts->shouldReceive('find')->with(1)->andReturn(null);
// call
$this->call('GET', '/chart/home/account/' . $account->id);
// test
$this->assertResponseOk();
$this->assertViewHas('message');
}
public function testhomeBudgets()