Expanded tests.

This commit is contained in:
James Cole
2016-01-24 16:25:03 +01:00
parent 00a8a9ac0e
commit 0f12ebb31c
3 changed files with 63 additions and 84 deletions

View File

@@ -4,8 +4,6 @@ use Amount;
use Carbon\Carbon; use Carbon\Carbon;
use Config; use Config;
use FireflyIII\Helpers\Report\ReportQueryInterface; use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\RuleTrigger;
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI; use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI; use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
@@ -48,7 +46,6 @@ class JsonController extends Controller
$view = view('rules.partials.action', compact('actions', 'count'))->render(); $view = view('rules.partials.action', compact('actions', 'count'))->render();
return Response::json(['html' => $view]); return Response::json(['html' => $view]);
} }

View File

@@ -1,21 +1,21 @@
<?php <?php
/* $factory->define(
|-------------------------------------------------------------------------- FireflyIII\User::class, function (Faker\Generator $faker) {
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(FireflyIII\User::class, function (Faker\Generator $faker) {
return [ return [
'name' => $faker->name, 'name' => $faker->name,
'email' => $faker->email, 'email' => $faker->email,
'password' => bcrypt(str_random(10)), 'password' => bcrypt(str_random(10)),
'remember_token' => str_random(10), 'remember_token' => str_random(10),
]; ];
}); }
);
$factory->define(
FireflyIII\Models\TransactionType::class, function (Faker\Generator $faker) {
return [
'type' => $faker->name,
];
}
);

View File

@@ -6,6 +6,7 @@
* This software may be modified and distributed under the terms * This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details. * of the MIT license. See the LICENSE file for details.
*/ */
use Illuminate\Support\Collection;
/** /**
@@ -16,157 +17,138 @@ class JsonControllerTest extends TestCase
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::action * @covers FireflyIII\Http\Controllers\JsonController::action
* @todo Implement testAction().
*/ */
public function testAction() public function testAction()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/action');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::boxBillsPaid * @covers FireflyIII\Http\Controllers\JsonController::boxBillsPaid
* @todo Implement testBoxBillsPaid().
*/ */
public function testBoxBillsPaid() public function testBoxBillsPaid()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/box/bills-paid');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::boxBillsUnpaid * @covers FireflyIII\Http\Controllers\JsonController::boxBillsUnpaid
* @todo Implement testBoxBillsUnpaid().
*/ */
public function testBoxBillsUnpaid() public function testBoxBillsUnpaid()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/box/bills-unpaid');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::boxIn * @covers FireflyIII\Http\Controllers\JsonController::boxIn
* @todo Implement testBoxIn().
*/ */
public function testBoxIn() public function testBoxIn()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/box/in');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::boxOut * @covers FireflyIII\Http\Controllers\JsonController::boxOut
* @todo Implement testBoxOut().
*/ */
public function testBoxOut() public function testBoxOut()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/box/out');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::categories * @covers FireflyIII\Http\Controllers\JsonController::categories
* @todo Implement testCategories().
*/ */
public function testCategories() public function testCategories()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/categories');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::endTour * @covers FireflyIII\Http\Controllers\JsonController::endTour
* @todo Implement testEndTour().
*/ */
public function testEndTour() public function testEndTour()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('POST', '/json/end-tour');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
); $this->assertEquals('"true"', $response->content());
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::expenseAccounts * @covers FireflyIII\Http\Controllers\JsonController::expenseAccounts
* @todo Implement testExpenseAccounts().
*/ */
public function testExpenseAccounts() public function testExpenseAccounts()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/expense-accounts');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::revenueAccounts * @covers FireflyIII\Http\Controllers\JsonController::revenueAccounts
* @todo Implement testRevenueAccounts().
*/ */
public function testRevenueAccounts() public function testRevenueAccounts()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/revenue-accounts');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::tags * @covers FireflyIII\Http\Controllers\JsonController::tags
* @todo Implement testTags().
*/ */
public function testTags() public function testTags()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/tags');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::tour * @covers FireflyIII\Http\Controllers\JsonController::tour
* @todo Implement testTour().
*/ */
public function testTour() public function testTour()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/tour');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::transactionJournals * @covers FireflyIII\Http\Controllers\JsonController::transactionJournals
* @todo Implement testTransactionJournals().
*/ */
public function testTransactionJournals() public function testTransactionJournals()
{ {
// Remove the following lines when you implement this test. $type = factory(FireflyIII\Models\TransactionType::class)->make();
$this->markTestIncomplete( $repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
'This test has not been implemented yet.'
); $repository->shouldReceive('getTransactionType')->with('deposit')->once()->andReturn($type);
$repository->shouldReceive('getJournalsOfType')->with($type)->once()->andReturn(new Collection);
$this->be($this->user());
$response = $this->call('GET', '/json/transaction-journals/deposit');
$this->assertEquals(200, $response->status());
} }
/** /**
* @covers FireflyIII\Http\Controllers\JsonController::trigger * @covers FireflyIII\Http\Controllers\JsonController::trigger
* @todo Implement testTrigger().
*/ */
public function testTrigger() public function testTrigger()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $response = $this->call('GET', '/json/trigger');
'This test has not been implemented yet.' $this->assertEquals(200, $response->status());
);
} }
} }