HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.shooperm.com/Modules/FooterSetting/Tests/Feature/FooterSettingTest.php
<?php

namespace Modules\FooterSetting\Tests\Feature;

use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Modules\FooterSetting\Entities\FooterWidget;

class FooterSettingTest extends TestCase
{
    use DatabaseTransactions;
    /**
     * A basic unit test example.
     *
     * @return void
     */
    public function test_for_footer_setting()
    {
        $this->actingAs(User::find(1));
        $response = $this->post('/footer/footer-setting',[
            'copy_right' => 'test',
            'id' => 1
        ]);
        
        $response->assertStatus(200);
    }

    public function test_for_footer_setting_widget_create(){
        $this->actingAs(User::find(1));

        $response = $this->post('/footer/footer-widget',[
            'name' => 'test',
            'slug' => 'test',
            'category' => 1,
            'section' => 1,
            'page' => 1,
            'status' => 1,
            'is_static' => 0,
            'user_id' => 1
        ]);
        $response->assertStatus(200);
    }

    public function test_for_footer_setting_widget_update(){
        
        $this->actingAs(User::find(1));

        $this->post('/footer/footer-widget',[
            'name' => 'test',
            'slug' => 'test',
            'category' => 1,
            'section' => 1,
            'page' => 1,
            'status' => 1,
            'is_static' => 0,
            'user_id' => 1
        ]);
        $widget = FooterWidget::orderBy('id','desc')->first();

        $this->post('/footer/footer-widget-update',[
            'name' => 'test',
            'slug' => 'test',
            'category' => 1,
            'section' => 1,
            'page' => 1,
            'status' => 1,
            'is_static' => 0,
            'user_id' => 1,
            'id' => $widget->id
        ])->assertRedirect('/footer/footer-setting');
    }

    public function test_for_footer_setting_widget_delete(){
        
        $this->actingAs(User::find(1));

        $this->post('/footer/footer-widget',[
            'name' => 'test',
            'slug' => 'test',
            'category' => 1,
            'section' => 1,
            'page' => 1,
            'status' => 1,
            'is_static' => 0,
            'user_id' => 1
        ]);
        $widget = FooterWidget::orderBy('id','desc')->first();
        $url = '/footer/footer-widget-delete/'. $widget->id; 

        $this->get($url)->assertRedirect('/footer/footer-setting');
    }

    public function test_for_footer_setting_widget_status_change(){
        
        $this->actingAs(User::find(1));

        $this->post('/footer/footer-widget',[
            'name' => 'test',
            'slug' => 'test',
            'category' => 1,
            'section' => 1,
            'page' => 1,
            'status' => 1,
            'is_static' => 0,
            'user_id' => 1
        ]);
        $widget = FooterWidget::orderBy('id','desc')->first();
        $this->post('/footer/footer-widget-status',[

            'status' => 1,
            'id' => $widget->id
        ])->assertStatus(200);
    }

}