Files
UNIT3D/tests/Feature/Http/Controllers/TopicControllerTest.php
HDVinnie 987bed7a7b Apply fixes from StyleCI
[ci skip] [skip ci]
2020-02-13 21:45:47 +00:00

194 lines
6.2 KiB
PHP

<?php
namespace Tests\Feature\Http\Controllers;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
/**
* @see \App\Http\Controllers\TopicController
*/
class TopicControllerTest extends TestCase
{
use RefreshDatabase;
/**
* @test
*/
public function add_form_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->get(route('forum_new_topic_form', ['id' => $topic->id]));
$response->assertRedirect(withErrors('You Cannot Start A New Topic Here!'));
// TODO: perform additional assertions
}
/**
* @test
*/
public function close_topic_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->get(route('forum_close', ['id' => $topic->id]));
$response->assertRedirect(withSuccess('This Topic Is Now Closed!'));
// TODO: perform additional assertions
}
/**
* @test
*/
public function delete_topic_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->get(route('forum_delete_topic', ['id' => $topic->id]));
$response->assertRedirect(withSuccess('This Topic Is Now Deleted!'));
// TODO: perform additional assertions
}
/**
* @test
*/
public function edit_form_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->get(route('forum_edit_topic_form', ['id' => $topic->id]));
$response->assertOk();
$response->assertViewIs('forum.edit_topic');
$response->assertViewHas('topic');
$response->assertViewHas('categories');
// TODO: perform additional assertions
}
/**
* @test
*/
public function edit_topic_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->post(route('forum_edit_topic', ['id' => $topic->id]), [
// TODO: send request data
]);
$response->assertRedirect(withSuccess('Topic Successfully Edited'));
// TODO: perform additional assertions
}
/**
* @test
*/
public function new_topic_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->post(route('forum_new_topic', ['id' => $topic->id]), [
// TODO: send request data
]);
$response->assertRedirect(withErrors('You Cannot Start A New Topic Here!'));
// TODO: perform additional assertions
}
/**
* @test
*/
public function open_topic_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->get(route('forum_open', ['id' => $topic->id]));
$response->assertRedirect(withSuccess('This Topic Is Now Open!'));
// TODO: perform additional assertions
}
/**
* @test
*/
public function pin_topic_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->get(route('forum_pin_topic', ['id' => $topic->id]));
$response->assertRedirect(withSuccess('This Topic Is Now Pinned!'));
// TODO: perform additional assertions
}
/**
* @test
*/
public function topic_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->get(route('forum_topic', ['id' => $topic->id]));
$response->assertRedirect(withErrors('You Do Not Have Access To Read This Topic!'));
// TODO: perform additional assertions
}
/**
* @test
*/
public function unpin_topic_returns_an_ok_response()
{
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$topic = factory(\App\Models\Topic::class)->create();
$user = factory(\App\Models\User::class)->create();
$response = $this->actingAs($user)->get(route('forum_unpin_topic', ['id' => $topic->id]));
$response->assertRedirect(withSuccess('This Topic Is Now Unpinned!'));
// TODO: perform additional assertions
}
// test cases...
}