ViewForumTest.php
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace FootyRoom\Tests;
class ViewForumTest extends TestCase
{
use SetsUpFixtures;
public function testGuessUserCanVisitForumAndSeeLoginButton()
{
$response = $this->call('GET', '/forum');
$this->assertEquals(200, $response->status());
$this->assertContains('Log In', $response->getContent());
$this->assertContains('to start discussion', $response->getContent());
$this->assertNotContains('New Discussion', $response->getContent());
$this->assertNotContains('With Me', $response->getContent());
$this->assertNotContains('My Threads', $response->getContent());
}
public function testLoggedInUserCanVisitForumAndSeeNewDiscussionButton()
{
$user = factory('FootyRoom\User\User')->make();
$response = $this->actingAs($user)->call('GET', '/forum');
$this->assertEquals(200, $response->status());
$this->assertNotContains('Log In', $response->getContent());
$this->assertNotContains('to start discussion', $response->getContent());
$this->assertContains('New Discussion', $response->getContent());
$this->assertContains('With Me', $response->getContent());
$this->assertContains('My Threads', $response->getContent());
}
public function testUserSeeExistingDiscussionPost()
{
$response = $this->call('GET', '/forum');
$this->assertEquals(200, $response->status());
$this->assertContains('my discussion title', $response->getContent());
}
}