Skip to content

Firefly III: a personal finances manager

New tests

James Coleda3988cc638b
diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php
index f64c807606..62e5c1298a 100644
--- a/app/Http/Controllers/Admin/ConfigurationController.php
+++ b/app/Http/Controllers/Admin/ConfigurationController.php
@@ -71,7 +71,7 @@ class ConfigurationController extends Controller
*
* @return \Illuminate\Http\RedirectResponse
*/
- public function store(ConfigurationRequest $request)
+ public function postIndex(ConfigurationRequest $request)
{
// get config values:
$data = $request->getConfigurationData();
diff --git a/resources/views/admin/configuration/index.twig b/resources/views/admin/configuration/index.twig
index 0864dfe379..e4d193315f 100644
--- a/resources/views/admin/configuration/index.twig
+++ b/resources/views/admin/configuration/index.twig
@@ -4,7 +4,7 @@
{{ Breadcrumbs.renderIfExists }}
{% endblock %}
{% block content %}
- <form action="{{ route('admin.configuration.store') }}" method="post" id="store" class="form-horizontal">
+ <form action="{{ route('admin.configuration.index.post') }}" method="post" id="store" class="form-horizontal">
<div class="row">
diff --git a/routes/web.php b/routes/web.php
index f26398c16f..3d9221d2a7 100755
--- a/routes/web.php
+++ b/routes/web.php
@@ -679,7 +679,7 @@ Route::group(
// FF configuration:
Route::get('configuration', ['uses' => 'ConfigurationController@index', 'as' => 'configuration.index']);
- Route::post('configuration', ['uses' => 'ConfigurationController@store', 'as' => 'configuration.store']);
+ Route::post('configuration', ['uses' => 'ConfigurationController@postIndex', 'as' => 'configuration.index.post']);
}
);
diff --git a/tests/acceptance/Controllers/Admin/ConfigurationControllerTest.php b/tests/acceptance/Controllers/Admin/ConfigurationControllerTest.php
index 7416398bba..d9be6296fe 100644
--- a/tests/acceptance/Controllers/Admin/ConfigurationControllerTest.php
+++ b/tests/acceptance/Controllers/Admin/ConfigurationControllerTest.php
@@ -35,22 +35,27 @@ class ConfigurationControllerTest extends TestCase
*/
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());
+ $this->call('GET', route('admin.configuration.index'));
+ $this->assertResponseStatus(200);
}
/**
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::store
* Implement testStore().
*/
- public function testStore()
+ public function testPostIndex()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('POST', route('admin.configuration.index.post'));
+
+ // mock FireflyConfig
+ \FireflyConfig::shouldReceive('get')->withArgs(['single_user_mode', false])->once();
+ \FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once();
+ \FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->once();
+
+ $this->assertSessionHas('success');
+ $this->assertResponseStatus(302);
}
/**
diff --git a/tests/acceptance/Controllers/Admin/DomainControllerTest.php b/tests/acceptance/Controllers/Admin/DomainControllerTest.php
index 71a17b8e5f..80e36fb4ad 100644
--- a/tests/acceptance/Controllers/Admin/DomainControllerTest.php
+++ b/tests/acceptance/Controllers/Admin/DomainControllerTest.php
@@ -35,10 +35,11 @@ class DomainControllerTest extends TestCase
*/
public function testDomains()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+
+ $this->be($this->user());
+ $this->call('GET', route('admin.users.domains'));
+ $this->assertResponseStatus(200);
+
}
/**
@@ -47,10 +48,10 @@ class DomainControllerTest extends TestCase
*/
public function testManual()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('POST', route('admin.users.domains.manual'), ['domain' => 'example2.com']);
+ $this->assertSessionHas('success');
+ $this->assertResponseStatus(302);
}
/**
@@ -59,10 +60,10 @@ class DomainControllerTest extends TestCase
*/
public function testToggleDomain()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $this->be($this->user());
+ $this->call('GET', route('admin.users.domains.block-toggle', ['example.com']));
+ $this->assertSessionHas('message');
+ $this->assertResponseStatus(302);
}
/**