This completes all controller acceptance tests

This commit is contained in:
James Cole
2016-12-19 20:21:14 +01:00
parent f172151252
commit e2e54d342a
3 changed files with 90 additions and 69 deletions

View File

@@ -8,6 +8,8 @@
* *
* See the LICENSE file for details. * 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() public function testIndex()
{ {
// Remove the following lines when you implement this test. $search = $this->mock(SearchInterface::class);
$this->markTestIncomplete( $search->shouldReceive('setLimit')->once();
'This test has not been implemented yet.' $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">');
} }
} }

View File

@@ -8,6 +8,8 @@
* *
* See the LICENSE file for details. * 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 * @covers \FireflyIII\Http\Controllers\TagController::create
* Implement testCreate().
*/ */
public function testCreate() public function testCreate()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $this->call('GET', route('tags.create'));
'This test has not been implemented yet.' $this->assertResponseStatus(200);
); $this->see('<ol class="breadcrumb">');
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TagController::delete * @covers \FireflyIII\Http\Controllers\TagController::delete
* Implement testDelete().
*/ */
public function testDelete() public function testDelete()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $this->call('GET', route('tags.delete', [1]));
'This test has not been implemented yet.' $this->assertResponseStatus(200);
); $this->see('<ol class="breadcrumb">');
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TagController::destroy * @covers \FireflyIII\Http\Controllers\TagController::destroy
* Implement testDestroy().
*/ */
public function testDestroy() public function testDestroy()
{ {
// Remove the following lines when you implement this test. $repository = $this->mock(TagRepositoryInterface::class);
$this->markTestIncomplete( $repository->shouldReceive('destroy');
'This test has not been implemented yet.'
); $this->be($this->user());
$this->call('post', route('tags.destroy', [1]));
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TagController::edit * @covers \FireflyIII\Http\Controllers\TagController::edit
* Implement testEdit().
*/ */
public function testEdit() public function testEdit()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $this->call('GET', route('tags.edit', [1]));
'This test has not been implemented yet.' $this->assertResponseStatus(200);
); $this->see('<ol class="breadcrumb">');
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TagController::index * @covers \FireflyIII\Http\Controllers\TagController::index
* Implement testIndex().
*/ */
public function testIndex() public function testIndex()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $this->call('GET', route('tags.index'));
'This test has not been implemented yet.' $this->assertResponseStatus(200);
); $this->see('<ol class="breadcrumb">');
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TagController::show * @covers \FireflyIII\Http\Controllers\TagController::show
* Implement testShow().
*/ */
public function testShow() public function testShow()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $this->call('GET', route('tags.show', [1]));
'This test has not been implemented yet.' $this->assertResponseStatus(200);
); $this->see('<ol class="breadcrumb">');
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TagController::store * @covers \FireflyIII\Http\Controllers\TagController::store
* Implement testStore().
*/ */
public function testStore() public function testStore()
{ {
// Remove the following lines when you implement this test. $this->session(['tags.create.url' => 'http://localhost']);
$this->markTestIncomplete( $data = [
'This test has not been implemented yet.' '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 * @covers \FireflyIII\Http\Controllers\TagController::update
* Implement testUpdate().
*/ */
public function testUpdate() public function testUpdate()
{ {
// Remove the following lines when you implement this test. $this->session(['tags.edit.url' => 'http://localhost']);
$this->markTestIncomplete( $data = [
'This test has not been implemented yet.' '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');
} }
} }

View File

@@ -28,61 +28,62 @@ class TransactionControllerTest extends TestCase
/** /**
* @covers \FireflyIII\Http\Controllers\TransactionController::index * @covers \FireflyIII\Http\Controllers\TransactionController::index
* Implement testIndex().
*/ */
public function testIndex() public function testIndex()
{ {
// Remove the following lines when you implement this test.
$this->markTestIncomplete( $this->be($this->user());
'This test has not been implemented yet.' $this->call('get', route('transactions.index', ['transfer']));
); $this->assertResponseStatus(200);
// has bread crumb
$this->see('<ol class="breadcrumb">');
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TransactionController::indexAll * @covers \FireflyIII\Http\Controllers\TransactionController::indexAll
* Implement testIndexAll().
*/ */
public function testIndexAll() public function testIndexAll()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $this->call('get', route('transactions.index.all', ['transfer']));
'This test has not been implemented yet.' $this->assertResponseStatus(200);
); // has bread crumb
$this->see('<ol class="breadcrumb">');
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TransactionController::indexByDate * @covers \FireflyIII\Http\Controllers\TransactionController::indexByDate
* Implement testIndexByDate().
*/ */
public function testIndexByDate() public function testIndexByDate()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $this->call('get', route('transactions.index.date', ['transfer', '2016-01-01']));
'This test has not been implemented yet.' $this->assertResponseStatus(200);
); // has bread crumb
$this->see('<ol class="breadcrumb">');
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TransactionController::reorder * @covers \FireflyIII\Http\Controllers\TransactionController::reorder
* Implement testReorder().
*/ */
public function testReorder() public function testReorder()
{ {
// Remove the following lines when you implement this test. $data = [
$this->markTestIncomplete( 'items' => [],
'This test has not been implemented yet.' ];
); $this->be($this->user());
$this->call('post', route('transactions.reorder'), $data);
$this->assertResponseStatus(200);
} }
/** /**
* @covers \FireflyIII\Http\Controllers\TransactionController::show * @covers \FireflyIII\Http\Controllers\TransactionController::show
* Implement testShow().
*/ */
public function testShow() public function testShow()
{ {
// Remove the following lines when you implement this test. $this->be($this->user());
$this->markTestIncomplete( $this->call('get', route('transactions.show', [1]));
'This test has not been implemented yet.' $this->assertResponseStatus(200);
); $this->see('<ol class="breadcrumb">');
} }
} }