Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
New user controller tests.
James Cole3399b133ae07
diff --git a/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.phpnew file mode 100644index 0000000000..6d5eccea35--- /dev/null+++ b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php@@ -0,0 +1,63 @@+<?php+/**+ * ConfigurationControllerTest.php+ * Copyright (c) 2017 [email protected]+ * This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.+ *+ * See the LICENSE file for details.+ */++declare(strict_types = 1);++namespace Tests\Feature\Controllers\Admin;+++use FireflyConfig;+use FireflyIII\Models\Configuration;+use Tests\TestCase;++class ConfigurationControllerTest extends TestCase+{++ /**+ * @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::index+ */+ public function testIndex()+ {+ $this->be($this->user());++ $falseConfig = new Configuration;+ $falseConfig->data = false;++ $trueConfig = new Configuration;+ $trueConfig->data = true;++ FireflyConfig::shouldReceive('get')->withArgs(['single_user_mode', true])->once()->andReturn($trueConfig);+ FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->times(2)->andReturn($falseConfig);++ $response = $this->get(route('admin.configuration.index'));+ $response->assertStatus(200);++ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');+ }++ /**+ * @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::postIndex+ */+ public function testPostIndex()+ {+ $falseConfig = new Configuration;+ $falseConfig->data = false;++ FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->once()->andReturn($falseConfig);+ FireflyConfig::shouldReceive('set')->withArgs(['single_user_mode', false])->once();+ FireflyConfig::shouldReceive('set')->withArgs(['is_demo_site', false])->once();++ $this->be($this->user());+ $response = $this->post(route('admin.configuration.index.post'));+ $response->assertSessionHas('success');+ $response->assertStatus(302);+ }++}\ No newline at end of filediff --git a/tests/Feature/Controllers/Admin/HomeControllerTest.php b/tests/Feature/Controllers/Admin/HomeControllerTest.phpnew file mode 100644index 0000000000..bffa7af54f--- /dev/null+++ b/tests/Feature/Controllers/Admin/HomeControllerTest.php@@ -0,0 +1,31 @@+<?php+/**+ * HomeControllerTest.php+ * Copyright (c) 2017 [email protected]+ * This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.+ *+ * See the LICENSE file for details.+ */++declare(strict_types = 1);++namespace Tests\Feature\Controllers\Admin;++use Tests\TestCase;++class HomeControllerTest extends TestCase+{++ /**+ * @covers \FireflyIII\Http\Controllers\Admin\HomeController::index+ */+ public function testIndex()+ {+ $this->be($this->user());+ $response = $this->get(route('admin.index'));+ $response->assertStatus(200);+ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');+ }++}\ No newline at end of filediff --git a/tests/Feature/Controllers/Admin/UserControllerTest.php b/tests/Feature/Controllers/Admin/UserControllerTest.phpnew file mode 100644index 0000000000..3ecb75fa53--- /dev/null+++ b/tests/Feature/Controllers/Admin/UserControllerTest.php@@ -0,0 +1,56 @@+<?php+/**+ * UserControllerTest.php+ * Copyright (c) 2017 [email protected]+ * This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.+ *+ * See the LICENSE file for details.+ */++declare(strict_types = 1);+++namespace Tests\Feature\Controllers\Admin;++use Tests\TestCase;++class UserControllerTest extends TestCase+{+ /**+ * @covers \FireflyIII\Http\Controllers\Admin\UserController::edit+ */+ public function testEdit()+ {+ $this->be($this->user());+ $response = $this->get(route('admin.users.edit', [1]));+ $response->assertStatus(200);+ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');+ }++ /**+ * @covers \FireflyIII\Http\Controllers\Admin\UserController::index+ */+ public function testIndex()+ {+ $this->be($this->user());+ $response = $this->get(route('admin.users'));+ $response->assertStatus(200);+ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');+ }++ /**+ * @covers \FireflyIII\Http\Controllers\Admin\UserController::show+ */+ public function testShow()+ {+ $this->be($this->user());+ $response = $this->get(route('admin.users.edit', [1]));+ $response->assertStatus(200);+ // has bread crumb+ $response->assertSee('<ol class="breadcrumb">');+ }+++}\ No newline at end of file