Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Test code cleanup.
James Cole7b2fe8eb4a7d
diff --git a/tests/acceptance/Controllers/AccountControllerTest.php b/tests/acceptance/Controllers/AccountControllerTest.phpindex 60d4591296..05513ca2e4 100644--- a/tests/acceptance/Controllers/AccountControllerTest.php+++ b/tests/acceptance/Controllers/AccountControllerTest.php@@ -38,14 +38,8 @@ class AccountControllerTest extends TestCasepublic function testDestroy(){$this->be($this->user());-- $args = [- '_token' => Session::token(),- ];-$this->session(['accounts.delete.url' => 'http://localhost']);-- $response = $this->call('POST', '/accounts/destroy/6', $args);+ $response = $this->call('POST', '/accounts/destroy/6');$this->assertSessionHas('success');$this->assertEquals(302, $response->status());}@@ -89,7 +83,6 @@ class AccountControllerTest extends TestCase$this->be($this->user());$this->session(['accounts.create.url' => 'http://localhost']);$args = [- '_token' => Session::token(),'name' => 'Some kind of test account.','what' => 'asset','amount_currency_id_virtualBalance' => 1,@@ -112,7 +105,6 @@ class AccountControllerTest extends TestCase'id' => 1,'name' => 'TestData new name','active' => 1,- '_token' => Session ::token(),];$this->be($this->user());diff --git a/tests/acceptance/Controllers/AttachmentControllerTest.php b/tests/acceptance/Controllers/AttachmentControllerTest.phpindex 1175579b18..8fb2923d92 100644--- a/tests/acceptance/Controllers/AttachmentControllerTest.php+++ b/tests/acceptance/Controllers/AttachmentControllerTest.php@@ -29,14 +29,8 @@ class AttachmentControllerTest extends TestCasepublic function testDestroy(){$this->be($this->user());-- $args = [- '_token' => Session::token(),- ];-$this->session(['attachments.delete.url' => 'http://localhost']);-- $response = $this->call('POST', '/attachment/destroy/2', $args);+ $response = $this->call('POST', '/attachment/destroy/2');$this->assertEquals(302, $response->status());}@@ -81,7 +75,6 @@ class AttachmentControllerTest extends TestCase'title' => 'New title','description' => 'New descr','notes' => 'New notes',- '_token' => Session::token(),];$this->be($this->user());diff --git a/tests/acceptance/Controllers/Auth/AuthControllerTest.php b/tests/acceptance/Controllers/Auth/AuthControllerTest.phpindex da8cd983fa..32b235619e 100644--- a/tests/acceptance/Controllers/Auth/AuthControllerTest.php+++ b/tests/acceptance/Controllers/Auth/AuthControllerTest.php@@ -74,7 +74,6 @@ class AuthControllerTest extends TestCase'email' => '[email protected]','password' => 'james','remember' => 1,- '_token' => Session::token(),];$response = $this->call('POST', '/login', $args);$this->assertEquals(302, $response->status());@@ -94,7 +93,6 @@ class AuthControllerTest extends TestCase'email' => '[email protected]','password' => 'james123','password_confirmation' => 'james123',- '_token' => Session::token(),];$response = $this->call('POST', '/register', $args);$this->assertEquals(302, $response->status());diff --git a/tests/acceptance/Controllers/Auth/PasswordControllerTest.php b/tests/acceptance/Controllers/Auth/PasswordControllerTest.phpindex 96655ba14c..6369fe0bb0 100644--- a/tests/acceptance/Controllers/Auth/PasswordControllerTest.php+++ b/tests/acceptance/Controllers/Auth/PasswordControllerTest.php@@ -19,7 +19,6 @@ class PasswordControllerTest extends TestCase{$args = ['email' => '[email protected]',- '_token' => Session::token(),];$response = $this->call('POST', '/password/email', $args);$this->assertEquals(302, $response->status());diff --git a/tests/acceptance/Controllers/BillControllerTest.php b/tests/acceptance/Controllers/BillControllerTest.phpindex d407daced8..d905af39ba 100644--- a/tests/acceptance/Controllers/BillControllerTest.php+++ b/tests/acceptance/Controllers/BillControllerTest.php@@ -42,10 +42,7 @@ class BillControllerTest extends TestCase{$this->session(['bills.delete.url' => 'http://localhost']);$this->be($this->user());- $args = [- '_token' => Session::token(),- ];- $response = $this->call('POST', '/bills/destroy/2', $args);+ $response = $this->call('POST', '/bills/destroy/2');$this->assertSessionHas('success');$this->assertEquals(302, $response->status());}@@ -100,7 +97,6 @@ class BillControllerTest extends TestCase$args = ['name' => 'Some test','match' => 'words',- '_token' => Session::token(),'amount_min' => 10,'amount_max' => 100,'amount_currency_id_amount_min' => 1,@@ -127,7 +123,6 @@ class BillControllerTest extends TestCase'id' => 1,'name' => 'Some test','match' => 'words',- '_token' => Session::token(),'amount_min' => 10,'amount_max' => 100,'amount_currency_id_amount_min' => 1,diff --git a/tests/acceptance/Controllers/BudgetControllerTest.php b/tests/acceptance/Controllers/BudgetControllerTest.phpindex 68ea18b6f0..a0dfeaadd5 100644--- a/tests/acceptance/Controllers/BudgetControllerTest.php+++ b/tests/acceptance/Controllers/BudgetControllerTest.php@@ -20,7 +20,6 @@ class BudgetControllerTest extends TestCase{$args = ['amount' => 1200,- '_token' => Session::token(),];$this->be($this->user());@@ -55,13 +54,8 @@ class BudgetControllerTest extends TestCase{$this->be($this->user());- $args = [- '_token' => Session::token(),- ];-$this->session(['budgets.delete.url' => 'http://localhost']);-- $response = $this->call('POST', '/budgets/destroy/2', $args);+ $response = $this->call('POST', '/budgets/destroy/2');$this->assertSessionHas('success');$this->assertEquals(302, $response->status());}@@ -103,7 +97,6 @@ class BudgetControllerTest extends TestCase{$args = ['amount' => 1200,- '_token' => Session::token(),];$this->be($this->user());@@ -129,7 +122,6 @@ class BudgetControllerTest extends TestCase$this->be($this->user());$this->session(['budgets.create.url' => 'http://localhost']);$args = [- '_token' => Session::token(),'name' => 'Some kind of test budget.',];@@ -146,7 +138,6 @@ class BudgetControllerTest extends TestCase$this->be($this->user());$this->session(['budgets.edit.url' => 'http://localhost']);$args = [- '_token' => Session::token(),'name' => 'Some kind of test budget.',];diff --git a/tests/acceptance/Controllers/CategoryControllerTest.php b/tests/acceptance/Controllers/CategoryControllerTest.phpindex a9c571321a..e8c90c78ae 100644--- a/tests/acceptance/Controllers/CategoryControllerTest.php+++ b/tests/acceptance/Controllers/CategoryControllerTest.php@@ -41,13 +41,9 @@ class CategoryControllerTest extends TestCase{$this->be($this->user());- $args = [- '_token' => Session::token(),- ];-$this->session(['categories.delete.url' => 'http://localhost']);- $response = $this->call('POST', '/categories/destroy/2', $args);+ $response = $this->call('POST', '/categories/destroy/2');$this->assertSessionHas('success');$this->assertEquals(302, $response->status());}@@ -84,6 +80,7 @@ class CategoryControllerTest extends TestCase/*** @covers FireflyIII\Http\Controllers\CategoryController::show+ * @covers FireflyIII\Http\Controllers\Controller::getSumOfRange*/public function testShow(){@@ -111,7 +108,6 @@ class CategoryControllerTest extends TestCase$this->be($this->user());$this->session(['categories.create.url' => 'http://localhost']);$args = [- '_token' => Session::token(),'name' => 'Some kind of test cat.',];@@ -128,7 +124,6 @@ class CategoryControllerTest extends TestCase$this->be($this->user());$this->session(['categories.edit.url' => 'http://localhost']);$args = [- '_token' => Session::token(),'name' => 'Some kind of test category.',];diff --git a/tests/acceptance/Controllers/CsvControllerTest.php b/tests/acceptance/Controllers/CsvControllerTest.phpindex ccd6a64598..84300209a6 100644--- a/tests/acceptance/Controllers/CsvControllerTest.php+++ b/tests/acceptance/Controllers/CsvControllerTest.php@@ -112,7 +112,6 @@ class CsvControllerTest extends TestCase6 => 'budget-name',],'map' => [],- '_token' => Session::token(),];// create session data:@@ -160,7 +159,6 @@ class CsvControllerTest extends TestCase$this->be($this->user());$this->session($this->getSessionData());$postData = [- '_token' => Session::token(),'mapping'=> [0 => ['NL11XOLA6707795988' => '1',],1 => ['NL10TAPT8906262744' => '0', 'NL93UPSZ1261542703' => '0', 'NL86IHAL3264575116' => '0', 'NL63BKBO9993148806' => '0',@@ -193,7 +191,6 @@ class CsvControllerTest extends TestCase$file = new UploadedFile(storage_path('build/test-upload.csv'), 'test-file.csv', 'text/plain', 446);$args = [- '_token' => Session::token(),'date_format' => 'Ymd','csv_import_account' => 1,];diff --git a/tests/acceptance/Controllers/CurrencyControllerTest.php b/tests/acceptance/Controllers/CurrencyControllerTest.phpindex 1864534bb8..618979d963 100644--- a/tests/acceptance/Controllers/CurrencyControllerTest.php+++ b/tests/acceptance/Controllers/CurrencyControllerTest.php@@ -51,15 +51,9 @@ class CurrencyControllerTest extends TestCase*/public function testDestroy(){- $args = [- '_token' => Session::token(),- ];-$this->session(['currency.delete.url' => 'http://localhost/currency']);--$this->be($this->user());- $response = $this->call('POST', '/currency/destroy/3', $args);+ $response = $this->call('POST', '/currency/destroy/3');$this->assertSessionHas('success');$this->assertRedirectedToRoute('currency.index');$this->assertEquals(302, $response->status());@@ -94,7 +88,6 @@ class CurrencyControllerTest extends TestCase$this->be($this->user());$this->session(['currency.create.url' => 'http://localhost/currency']);$args = [- '_token' => Session::token(),'name' => 'New Euro.','symbol' => 'Y','code' => 'IUY',@@ -118,7 +111,6 @@ class CurrencyControllerTest extends TestCase'name' => 'New Euro.','symbol' => 'Y','code' => 'IUY',- '_token' => Session::token(),];$this->be($this->user());diff --git a/tests/acceptance/Controllers/HomeControllerTest.php b/tests/acceptance/Controllers/HomeControllerTest.phpindex 962e0b9869..3bbeb802da 100644--- a/tests/acceptance/Controllers/HomeControllerTest.php+++ b/tests/acceptance/Controllers/HomeControllerTest.php@@ -20,7 +20,6 @@ class HomeControllerTest extends TestCase$args = ['start' => '2012-01-01','end' => '2012-04-01',- '_token' => Session::token(),];// if date range is > 50, should have flash.@@ -41,6 +40,7 @@ class HomeControllerTest extends TestCase/*** @covers FireflyIII\Http\Controllers\HomeController::index+ * @covers FireflyIII\Http\Controllers\Controller::__construct*/public function testIndex(){diff --git a/tests/acceptance/Controllers/NewUserControllerTest.php b/tests/acceptance/Controllers/NewUserControllerTest.phpindex 9b27d98a94..01841352f4 100644--- a/tests/acceptance/Controllers/NewUserControllerTest.php+++ b/tests/acceptance/Controllers/NewUserControllerTest.php@@ -16,25 +16,39 @@ class NewUserControllerTest extends TestCase/*** @covers FireflyIII\Http\Controllers\NewUserController::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->emptyUser());+ $this->call('GET', '/');+ $this->assertResponseStatus(302);+ $this->assertRedirectedToRoute('new-user.index');+ }++ /**+ * @covers FireflyIII\Http\Controllers\NewUserController::index+ */+ public function testIndexGo()+ {+ $this->be($this->emptyUser());+ $this->call('GET', '/new-user');+ $this->assertResponseStatus(200);}/*** @covers FireflyIII\Http\Controllers\NewUserController::submit- * @todo Implement testSubmit().*/public function testSubmit(){- // Remove the following lines when you implement this test.- $this->markTestIncomplete(- 'This test has not been implemented yet.'- );+ $this->be($this->emptyUser());++ $args = [+ 'bank_name' => 'New bank',+ 'bank_balance' => 100,+ ];++ $this->call('POST', '/new-user/submit', $args);+ $this->assertResponseStatus(302);+ $this->assertSessionHas('success');}}