<commit_before><?php

namespace Tests\Browser;

use App\User;
use Tests\DuskTestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;

/**
 * Class ManageTagTest
 * @package Tests\Browser
 */
class ManageTagTest extends DuskTestCase
{
    use DatabaseMigrations;

    /**
     * Tag index
     * @return void
     */
    public function testTagIndex()
    {
        $user = factory(User::class)->create([
            'email' => '<EMAIL>',
        ]);

        $this->browse(function ($browser) use ($user) {
            // Make sure we can't see it without logging in
            $browser->visit(route('admin.tags.index'))
                ->assertDontSee('View all tags')// We don't see the title
                ->assertSee('Login'); // We see the login page

            $browser->loginAs($user)
                ->visit(route('admin.tags.index'))
                ->assertSee('View all tags');
        });
    }

    /**
     * Tag create page
     * @return void
     */
    public function testTagCreate()
    {
        $user = factory(User::class)->create([
            'email' => '<EMAIL>',
        ]);

        $this->browse(function ($browser) use ($user) {
            $browser->loginAs($user)
                ->visit(route('admin.tags.create'))
                ->assertSee('Create tag')
                ->type('name', 'My cool new tag!')
                ->press('Save')
                ->assertSee('My cool new tag!')
                ->assertSee('Show My cool new tag!');
        });
    }
}<commit_msg>Add tag view test<commit_after><?php

namespace Tests\Browser;

use App\Models\Tag;
use App\User;
use Tests\DuskTestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;

/**
 * Class ManageTagTest
 * @package Tests\Browser
 */
class ManageTagTest extends DuskTestCase
{
    use DatabaseMigrations;

    /**
     * Tag index
     * @return void
     */
    public function testTagIndex()
    {
        $user = factory(User::class)->create([
            'email' => '<EMAIL>',
        ]);

        $this->browse(function ($browser) use ($user) {
            // Make sure we can't see it without logging in
            $browser->visit(route('admin.tags.index'))
                ->assertDontSee('View all tags')// We don't see the title
                ->assertSee('Login'); // We see the login page

            $browser->loginAs($user)
                ->visit(route('admin.tags.index'))
                ->assertSee('View all tags');
        });
    }

    /**
     * Tag create page
     * @return void
     */
    public function testTagCreate()
    {
        $user = factory(User::class)->create([
            'email' => '<EMAIL>',
        ]);

        $this->browse(function ($browser) use ($user) {
            $browser->loginAs($user)
                ->visit(route('admin.tags.create'))
                ->assertSee('Create tag')
                ->type('name', 'My cool new tag!')
                ->press('Save')
                ->assertSee('My cool new tag!')
                ->assertSee('Show My cool new tag!');
        });
    }

    /**
     * Tag create page
     * @return void
     */
    public function testTagView()
    {
        // Create a user so we can login and see tags
        $user = factory(User::class)->create([
            'email' => '<EMAIL>',
        ]);

        // Create a tag
        $tag = factory(Tag::class)->create([
            'name' => 'My Test Tag',
        ]);

        $this->browse(function ($browser) use ($user, $tag) {
            $browser->loginAs($user)
                ->visit(route('admin.tags.show', [$tag->id]))
                ->assertSee('Show My Test Tag');
        });
    }
}
{'fraction_non_alphanumeric': 0.15540355677154583, 'fraction_numerical': 0.0, 'mean_word_length': 1.7447447447447448, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2467763', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1011, 'n_words': 244}