GuestUserCommentTest.php 592 Bytes
<?php

namespace FootyRoom\Tests;

class GuestUserCommentTest extends TestCase
{
    use SetsUpFixtures;

    public function testGuestUserNotAllowedToCommentInMatchAndThrowCorrectError()
    {
        $faker = \Faker\Factory::create();

        $data = [
            'parent' => 0,
            'comment' => $faker->paragraph(),
            'commentableId' => 1957, //MatchId
        ];

        $response = $this->call('POST', '/matches/comment', $data);
        $this->assertEquals(403, $response->status());
        $this->assertContains('Access Denied', $response->getContent());
    }
}