Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
This completes all controller acceptance tests
James Colee2e54d342a20
diff --git a/tests/acceptance/Controllers/SearchControllerTest.php b/tests/acceptance/Controllers/SearchControllerTest.phpindex 8bc0f55566..68b1b97636 100644--- a/tests/acceptance/Controllers/SearchControllerTest.php+++ b/tests/acceptance/Controllers/SearchControllerTest.php@@ -8,6 +8,8 @@** See the LICENSE file for details.*/+use FireflyIII\Support\Search\SearchInterface;+use Illuminate\Support\Collection;/**@@ -32,9 +34,16 @@ class SearchControllerTest extends TestCase*/public function testIndex(){- // Remove the following lines when you implement this test.- $this->markTestIncomplete(- 'This test has not been implemented yet.'- );+ $search = $this->mock(SearchInterface::class);+ $search->shouldReceive('setLimit')->once();+ $search->shouldReceive('searchTransactions')->andReturn(new Collection)->withArgs([['test']])->once();+ $search->shouldReceive('searchBudgets')->andReturn(new Collection)->withArgs([['test']])->once();+ $search->shouldReceive('searchTags')->andReturn(new Collection)->withArgs([['test']])->once();+ $search->shouldReceive('searchCategories')->andReturn(new Collection)->withArgs([['test']])->once();+ $search->shouldReceive('searchAccounts')->andReturn(new Collection)->withArgs([['test']])->once();+ $this->be($this->user());+ $this->call('get', route('search.index') . '?q=test');+ $this->assertResponseStatus(200);+ $this->see('<ol class="breadcrumb">');}}diff --git a/tests/acceptance/Controllers/TagControllerTest.php b/tests/acceptance/Controllers/TagControllerTest.phpindex 362578276d..4a7717d528 100644--- a/tests/acceptance/Controllers/TagControllerTest.php+++ b/tests/acceptance/Controllers/TagControllerTest.php@@ -8,6 +8,8 @@** See the LICENSE file for details.*/+use FireflyIII\Models\Tag;+use FireflyIII\Repositories\Tag\TagRepositoryInterface;/**@@ -28,97 +30,106 @@ class TagControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\TagController::create- * 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());+ $this->call('GET', route('tags.create'));+ $this->assertResponseStatus(200);+ $this->see('<ol class="breadcrumb">');}/*** @covers \FireflyIII\Http\Controllers\TagController::delete- * 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());+ $this->call('GET', route('tags.delete', [1]));+ $this->assertResponseStatus(200);+ $this->see('<ol class="breadcrumb">');}/*** @covers \FireflyIII\Http\Controllers\TagController::destroy- * Implement testDestroy().*/public function testDestroy(){- // Remove the following lines when you implement this test.- $this->markTestIncomplete(- 'This test has not been implemented yet.'- );+ $repository = $this->mock(TagRepositoryInterface::class);+ $repository->shouldReceive('destroy');++ $this->be($this->user());+ $this->call('post', route('tags.destroy', [1]));+ $this->assertResponseStatus(302);+ $this->assertSessionHas('success');}/*** @covers \FireflyIII\Http\Controllers\TagController::edit- * 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());+ $this->call('GET', route('tags.edit', [1]));+ $this->assertResponseStatus(200);+ $this->see('<ol class="breadcrumb">');}/*** @covers \FireflyIII\Http\Controllers\TagController::index- * 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());+ $this->call('GET', route('tags.index'));+ $this->assertResponseStatus(200);+ $this->see('<ol class="breadcrumb">');}/*** @covers \FireflyIII\Http\Controllers\TagController::show- * 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());+ $this->call('GET', route('tags.show', [1]));+ $this->assertResponseStatus(200);+ $this->see('<ol class="breadcrumb">');}/*** @covers \FireflyIII\Http\Controllers\TagController::store- * 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(['tags.create.url' => 'http://localhost']);+ $data = [+ 'tag' => 'Hello new tag' . rand(999, 10000),+ 'tagMode' => 'nothing',+ ];+ $this->be($this->user());+ $this->call('post', route('tags.store'), $data);+ $this->assertResponseStatus(302);+ $this->assertSessionHas('success');}/*** @covers \FireflyIII\Http\Controllers\TagController::update- * 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(['tags.edit.url' => 'http://localhost']);+ $data = [+ 'tag' => 'Hello updated tag' . rand(999, 10000),+ 'tagMode' => 'nothing',+ ];+ $repository = $this->mock(TagRepositoryInterface::class);+ $repository->shouldReceive('update');+ $repository->shouldReceive('find')->andReturn(new Tag);++ $this->be($this->user());+ $this->call('post', route('tags.update', [1]), $data);+ $this->assertResponseStatus(302);+ $this->assertSessionHas('success');}}diff --git a/tests/acceptance/Controllers/TransactionControllerTest.php b/tests/acceptance/Controllers/TransactionControllerTest.phpindex aa97b8b7a4..d5e596fd60 100644--- a/tests/acceptance/Controllers/TransactionControllerTest.php+++ b/tests/acceptance/Controllers/TransactionControllerTest.php@@ -28,61 +28,62 @@ class TransactionControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\TransactionController::index- * 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());+ $this->call('get', route('transactions.index', ['transfer']));+ $this->assertResponseStatus(200);+ // has bread crumb+ $this->see('<ol class="breadcrumb">');}/*** @covers \FireflyIII\Http\Controllers\TransactionController::indexAll- * Implement testIndexAll().*/public function testIndexAll(){- // 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('transactions.index.all', ['transfer']));+ $this->assertResponseStatus(200);+ // has bread crumb+ $this->see('<ol class="breadcrumb">');}/*** @covers \FireflyIII\Http\Controllers\TransactionController::indexByDate- * Implement testIndexByDate().*/public function testIndexByDate(){- // 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('transactions.index.date', ['transfer', '2016-01-01']));+ $this->assertResponseStatus(200);+ // has bread crumb+ $this->see('<ol class="breadcrumb">');}/*** @covers \FireflyIII\Http\Controllers\TransactionController::reorder- * Implement testReorder().*/public function testReorder(){- // Remove the following lines when you implement this test.- $this->markTestIncomplete(- 'This test has not been implemented yet.'- );+ $data = [+ 'items' => [],+ ];+ $this->be($this->user());+ $this->call('post', route('transactions.reorder'), $data);+ $this->assertResponseStatus(200);}/*** @covers \FireflyIII\Http\Controllers\TransactionController::show- * 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());+ $this->call('get', route('transactions.show', [1]));+ $this->assertResponseStatus(200);+ $this->see('<ol class="breadcrumb">');}}