CommentShouldSeeDataInDbTest.php
847 Bytes
<?php
namespace FootyRoom\Tests;
use Illuminate\Database\Connection;
class CommentShouldSeeDataInDbTest extends TestCase
{
use SetsUpFixtures;
public function setup()
{
parent::setup();
$this->mysql = $this->app->make(Connection::class);
}
public function testSuccessCommentShouldSeeDataInDatabase()
{
$user = factory('FootyRoom\User\User')->make(['user_id' => 1]);
$response = $this->actingAs($user)->call('POST', '/forum/comments', ['content' => 'a', 'postId' => 1]);
$this->assertEquals(200, $response->status());
$comment = $this->mysql->table('comments')
->where('discussion_id', '=', 'forumPost:1')
->where('user_id', '=', 1)
->where('content', '=', 'a')
->first();
$this->assertNotNull($comment);
}
}