Blame view

tests/integration/Comment/CreateComment/CommentShouldSeeDataInDbTest.php 847 Bytes
e77200db5   nologostudio.ru   Initial commit
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
  <?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);
      }
  }