<commit_before><?php

use Suyabay\Like;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class LikeEpisodeTest extends TestCase
{
    /**
     * Assert that:
     *  An authenticated user can like an episode.
     *  LikeRepository's getUserFavorite returns all
     *  episodes favvorited by a user.
     *
     * @return [type] [description]
     */
    public function testGetUserFavorite()
    {
        $this->withoutMiddleware();

        $user = factory('Suyabay\User')->create();
        factory('Suyabay\Channel')->create();
        factory('Suyabay\Episode')->create(['status' => 1]);

        $this->actingAs($user)
             ->call(
                 'POST',
                 '/episode/like',
                 [
                    'user_id' => $user['id'],
                    'episode_id' => 1
                 ]
             );
        $newLike = self::$likerepisitory->getUserFavorite('user_id', 1);
        $newLike = $newLike->get()->toArray();

        $this->assertTrue(is_array($newLike));
        $this->assertArrayHasKey('episode_id', $newLike[0]);
        $this->assertArrayHasKey('user_id', $newLike[0]);
    }
}
<commit_msg>(chore)[#115105429] Assert LikeEpisodeTest's findLikeWhere returns all episodes that match a criteria<commit_after><?php

use Suyabay\Like;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class LikeEpisodeTest extends TestCase
{
    /**
     * Assert that:
     *  An authenticated user can like an episode.
     *  LikeRepository's getUserFavorite returns all
     *  episodes favvorited by a user.
     *
     * @return [type] [description]
     */
    public function testGetUserFavorite()
    {
        $this->withoutMiddleware();

        $user = factory('Suyabay\User')->create();
        factory('Suyabay\Channel')->create();
        factory('Suyabay\Episode')->create(['status' => 1]);

        $this->actingAs($user)
             ->call(
                 'POST',
                 '/episode/like',
                 [
                    'user_id' => $user['id'],
                    'episode_id' => 1
                 ]
             );
        $newLike = self::$likerepisitory->getUserFavorite('user_id', 1);
        $newLike = $newLike->get()->toArray();

        $this->assertTrue(is_array($newLike));
        $this->assertArrayHasKey('episode_id', $newLike[0]);
        $this->assertArrayHasKey('user_id', $newLike[0]);

        $newLike = self::$likerepisitory->findLikeWhere('episode_id', 1);
        $newLike = $newLike->get()->toArray();

        $this->assertTrue(is_array($newLike));
        $this->assertArrayHasKey('episode_id', $newLike[0]);
        $this->assertArrayHasKey('user_id', $newLike[0]);
    }
}

{'fraction_non_alphanumeric': 0.14702851253864652, 'fraction_numerical': 0.007557540364136035, 'mean_word_length': 2.454329774614472, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3680122', 'n_tokens_mistral': 878, 'n_tokens_neox': 866, 'n_words': 142}