NewBornCreateDiscussionWithLinkTest.php
1.42 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
39
<?php
namespace FootyRoom\Tests;
class NewBornCreateDiscussionWithLinkTest extends TestCase
{
use SetsUpFixtures;
public function testNewBornUserShouldNotBeAllowedToCreateDiscussionWithLinkInContent()
{
$faker = \Faker\Factory::create();
$data = [
'title' => $faker->sentence(),
'content' => $faker->paragraph().'http://google.com',
'category' => 53,
];
$user = factory('FootyRoom\User\User')->make(['user_id' => 1]);
$response = $this->actingAs($user)->call('POST', '/forum/discussions', $data);
$this->assertEquals(201, $response->status());
$user = factory('FootyRoom\User\User')->make(['user_id' => 2]);
$response = $this->actingAs($user)->call('POST', '/forum/discussions', $data);
$this->assertEquals(500, $response->status());
$this->assertContains('New users are not allowed to post links.', $response->getContent());
$data = [
'title' => $faker->sentence(),
'content' => $faker->paragraph().'https://google.com',
'category' => 53,
];
$user = factory('FootyRoom\User\User')->make(['user_id' => 2]);
$response = $this->actingAs($user)->call('POST', '/forum/discussions', $data);
$this->assertEquals(500, $response->status());
$this->assertContains('New users are not allowed to post links.', $response->getContent());
}
}