Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mcoil.corals.io/tests/Feature/Admin/Businesses/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mcoil.corals.io/tests/Feature/Admin/Businesses/BusinessesFeatureTest.php
<?php

namespace Tests\Feature\Admin\Businesses;

use Illuminate\Support\Str;
use Tests\TestCase;
use App\Shop\Rrps\Rrp;
use App\Shop\Businesses\Business;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;

class BusinessesFeatureTest extends TestCase
{
    /** @test */
    public function it_can_create_the_business()
    {
        $rrp = factory(Rrp::class, 9)->create();
        $data = factory(Business::class)->make()->toArray();

        $this->actingAs($this->employee, 'employee')
            ->post(route('admin.businesses.store'), $data)
            ->assertStatus(302)
            ->assertRedirect(route('admin.businesses.index'));
        $data['contacts'] = json_encode($data['contacts']);
        $this->assertDatabaseHas('businesses', $data);
    }

    /** @test */
    public function it_can_search_for_the_business()
    {
        $rrp = factory(Rrp::class, 9)->create();
        $business = factory(Business::class)->create();
        $param = ['q' => Str::slug($business->title)];

        $this
            ->actingAs($this->employee, 'employee')
            ->get(route('admin.businesses.index', $param))
            ->assertSee($business->title)
            ->assertStatus(200)
            ;
    }

    /** @test */
    public function it_can_show_the_create_and_edit_page()
    {
        $rrp = factory(Rrp::class, 9)->create();
        $business = factory(Business::class)->create();

        $this
            ->actingAs($this->employee, 'employee')
            ->get(route('admin.businesses.create'))
            ->assertStatus(200);


        $this
            ->actingAs($this->employee, 'employee')
            ->get(route('admin.businesses.edit', $business->id))
            ->assertStatus(200)
            ->assertSee(htmlentities($business->title, ENT_QUOTES));

    }

    /** @test */
    public function it_can_update_the_business()
    {
        $rrp = factory(Rrp::class, 9)->create();
        $business = factory(Business::class)->create();

        $data = [
            'title' => $this->faker->word,
            'email' => $this->faker->email
        ];

        $this->actingAs($this->employee, 'employee')
            ->put(route('admin.businesses.update', $business->id), $data)
            ->assertStatus(302)
            ->assertRedirect(route('admin.businesses.edit', $business->id));

        $this->assertDatabaseHas('businesses', $data);
    }

    /** @test */
    public function it_can_show_all_the_businesses()
    {
        factory(Rrp::class, 9)->create();
        factory(Business::class, 20)->create();

        $this->actingAs($this->employee, 'employee')
            ->get(route('admin.businesses.index'))
            ->assertViewHas(['businesses']);
    }

    /** @test */
    public function it_can_delete_the_businesses()
    {
        $rrp = factory(Rrp::class, 9)->create();
        $business = factory(Business::class)->create();

        $this
            ->actingAs($this->employee, 'employee')
            ->delete(route('admin.businesses.destroy', $business->id))
            ->assertStatus(302)
            ->assertRedirect(route('admin.businesses.index'))
            ->assertSessionHas('message', 'Delete successful');
    }
}

Spamworldpro Mini