Some new tests

This commit is contained in:
James Cole 2016-01-23 16:48:34 +01:00
parent 99d14e8cbe
commit 935dc3ff9f
2 changed files with 74 additions and 45 deletions

View File

@ -16,97 +16,116 @@ class CurrencyControllerTest extends TestCase
/**
* @covers FireflyIII\Http\Controllers\CurrencyController::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', '/currency/create');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\CurrencyController::defaultCurrency
* @todo Implement testDefaultCurrency().
*/
public function testDefaultCurrency()
{
// 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', '/currency/default/2');
$this->assertEquals(302, $response->status());
$this->assertRedirectedToRoute('currency.index');
$this->assertSessionHas('success');
}
/**
* @covers FireflyIII\Http\Controllers\CurrencyController::delete
* @todo Implement testDelete().
*/
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', '/currency/delete/2');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\CurrencyController::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.'
);
$args = [
'_token' => Session::token(),
];
$this->session(['currency.delete.url' => 'http://localhost/currency']);
$this->be($this->user());
$response = $this->call('POST', '/currency/destroy/3', $args);
$this->assertSessionHas('success');
$this->assertRedirectedToRoute('currency.index');
$this->assertEquals(302, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\CurrencyController::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', '/currency/edit/2');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\CurrencyController::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', '/currency');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\CurrencyController::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->be($this->user());
$this->session(['currency.create.url' => 'http://localhost/currency']);
$args = [
'_token' => Session::token(),
'name' => 'New Euro.',
'symbol' => 'Y',
'code' => 'IUY',
];
$response = $this->call('POST', '/currency/store', $args);
$this->assertEquals(302, $response->status());
$this->assertSessionHas('success');
$this->assertRedirectedToRoute('currency.index');
}
/**
* @covers FireflyIII\Http\Controllers\CurrencyController::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(['currency.edit.url' => 'http://localhost/currency']);
$args = [
'id' => 1,
'name' => 'New Euro.',
'symbol' => 'Y',
'code' => 'IUY',
'_token' => Session::token(),
];
$this->be($this->user());
$response = $this->call('POST', '/currency/update/1', $args);
$this->assertEquals(302, $response->status());
$this->assertSessionHas('success');
$this->assertRedirectedToRoute('currency.index');
}
}

View File

@ -16,13 +16,23 @@ class HelpControllerTest extends TestCase
/**
* @covers FireflyIII\Http\Controllers\HelpController::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', '/help/index');
$this->assertEquals(200, $response->status());
}
/**
* @covers FireflyIII\Http\Controllers\HelpController::show
*/
public function testShowNoRoute()
{
$this->be($this->user());
$response = $this->call('GET', '/help/indxxex');
$this->assertEquals(200, $response->status());
}
}