Some tests

This commit is contained in:
James Cole 2016-01-20 15:27:53 +01:00
parent c9e4a09da6
commit 441ba79ec7
2 changed files with 67 additions and 45 deletions

View File

@ -33,7 +33,7 @@ class TestDataSeeder extends Seeder
// create asset accounts for user #1.
$this->createAssetAccounts($user);
// create a bills for user #1
// create bills for user #1
$this->createBills($user);
// create some budgets for user #1

View File

@ -16,14 +16,12 @@ class BillControllerTest extends TestCase
/**
* @covers FireflyIII\Http\Controllers\BillController::create
* @todo Implement testCreate().
*/
public function testCreate()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$response = $this->call('GET', '/bills/create');
$this->assertEquals(200, $response->status());
}
/**
@ -32,93 +30,117 @@ class BillControllerTest extends TestCase
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$response = $this->call('GET', '/bills/delete/1');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\BillController::destroy
* @todo Implement testDestroy().
*/
public function testDestroy()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->session(['bills.delete.url' => 'http://localhost']);
$this->be($this->user());
$args = [
'_token' => Session::token(),
];
$response = $this->call('POST', '/bills/destroy/2', $args);
$this->assertSessionHas('success');
$this->assertEquals(302, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\BillController::edit
* @todo Implement testEdit().
*/
public function testEdit()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$response = $this->call('GET', '/bills/edit/1');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\BillController::index
* @todo Implement testIndex().
*/
public function testIndex()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$response = $this->call('GET', '/bills');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\BillController::rescan
* @todo Implement testRescan().
*/
public function testRescan()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$response = $this->call('GET', '/bills/rescan/1');
$this->assertSessionHas('success');
$this->assertEquals(302, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\BillController::show
* @todo Implement testShow().
*/
public function testShow()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->be($this->user());
$response = $this->call('GET', '/bills/show/1');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\BillController::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.'
);
$this->session(['bills.create.url' => 'http://localhost']);
$args = [
'name' => 'Some test',
'match' => 'words',
'_token' => Session::token(),
'amount_min' => 10,
'amount_max' => 100,
'amount_currency_id_amount_min' => 1,
'amount_currency_id_amount_max' => 1,
'date' => '20160101',
'repeat_freq' => 'monthly',
'skip' => 0,
];
$this->be($this->user());
$response = $this->call('POST', '/bills/store', $args);
$this->assertSessionHas('success');
$this->assertEquals(302, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\BillController::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.'
);
$this->session(['bills.edit.url' => 'http://localhost']);
$args = [
'id' => 1,
'name' => 'Some test',
'match' => 'words',
'_token' => Session::token(),
'amount_min' => 10,
'amount_max' => 100,
'amount_currency_id_amount_min' => 1,
'amount_currency_id_amount_max' => 1,
'date' => '20160101',
'repeat_freq' => 'monthly',
'skip' => 0,
];
$this->be($this->user());
$response = $this->call('POST', '/bills/update/1', $args);
$this->assertSessionHas('success');
$this->assertEquals(302, $response->status());
}
}