!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/classify.picotech.app/public_html/tests/Feature/Admin/   drwxr-xr-x
Free 28.18 GB of 117.98 GB (23.88%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     AffiliateTest.php (4.68 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

use App\Models\Affiliate;
use 
App\Models\AffiliatePointHistory;
use 
App\Models\AffiliateSetting;
use 
App\Models\RedeemPoint;
use 
App\Models\User;
use 
Database\Seeders\AffiliatePointSeeder;
use 
Database\Seeders\AffiliatesTableSeeder;
use 
Database\Seeders\UserSeeder;
use 
Illuminate\Foundation\Testing\RefreshDatabase;
use 
Illuminate\Http\Request;

uses(RefreshDatabase::class);

test('admin can get partners', function () {
    
$this->admin createAdmin();
    
$this->actingAs($this->admin'admin');
    
$this->withoutExceptionHandling();
    
$this->get(route('affiliate.partners'))->assertStatus(200);
});

test('admin can get balance requests', function () {
    
$this->admin createAdmin();
    
$this->actingAs($this->admin'admin');
    
$this->withoutExceptionHandling();
    
$this->get(route('affiliate.balance.request'))->assertStatus(200);
});

test('admin can confirm balance request', function () {
    
$this->admin createAdmin();
    
$this->actingAs($this->admin'admin');
    
$this->seed([AffiliatesTableSeeder::class]);
    
$this->seed([AffiliatePointSeeder::class]);
    
$requestBalance AffiliatePointHistory::first();
    
$partnerWallet Affiliate::first();
    
$response $this->get(route('affiliate.balance.request.confirm', ['id' => $requestBalance->id]));
    
$this->assertDatabaseHas('affiliates', [
        
'user_id' => $partnerWallet->user_id,
        
'balance' => $partnerWallet->balance $requestBalance->pricing,
    ]);
    
$this->assertDatabaseHas('affiliate_point_histories', [
        
'id' => $requestBalance->id,
        
'status' => 1,
    ]);
    
$response->assertStatus(302);
});

test('admin can access affiliate setting index', function () {
    
$this->admin createAdmin();
    
$this->actingAs($this->admin'admin');
    
//  $affiliateSettings = AffiliateSetting::first();
    
$response $this->get(route('affiliate-settings.index'));
    
$response->assertOk();
    
//  $response->assertViewIs('admin.affiliate-settings.index',compact('affiliateSettings'));
    //  $response->assertViewHas('affiliateSettings', $affiliateSettings);

});

test('admin update affiliate setting', function () {
    
$this->admin createAdmin();
    
$this->actingAs($this->admin'admin');
    
$affiliateSetting AffiliateSetting::first();

    
$request = new Request([
        
'invite_points' => 10,
        
'point_convert_permission' => 1,
    ]);
    
$response $this->put('admin/affiliate-settings/'.$affiliateSetting->id$request->all());
    
$response->assertStatus(302);
    
$response->assertRedirect(route('affiliate-settings.index'));

    
$this->assertDatabaseHas('affiliate_settings', [
        
'invite_points' => 10,
        
'point_convert_permission' => 1,
    ]);
});

test('user can generate affiliate code and redirect to wallet', function () {
    
$this->seed(UserSeeder::class);
    
$user User::first();

    
Affiliate::create(['user_id' => $user->id]);

    
$this->actingAs($user)->get(route('frontend.become.affiliate'))->assertStatus(302)->assertRedirect(route('frontend.wallet'));

    
$wallet Affiliate::where('user_id'$user->id)->first();

    
$this->assertNotNull($wallet);
    
$this->assertNotNull($wallet->affiliate_code);
    
$this->assertGreaterThanOrEqual(100000$wallet->affiliate_code);
    
$this->assertLessThanOrEqual(999999$wallet->affiliate_code);
});

test('user can return wallet view with correct data when affiliate code is not null', function () {
    
$this->seed(UserSeeder::class);
    
$user User::first();

    
Affiliate::create(['user_id' => $user->id'affiliate_code' => rand(100000999999)]);

    
$response $this->actingAs($user)->get(route('frontend.wallet'));
    
$response->assertStatus(200);
});

test('it should deduct points and add balance when point conversion is allowed', function () {
    
$this->seed(UserSeeder::class);
    
$user User::first();

    
$affiliate Affiliate::create(['user_id' => $user->id'total_points' => 500]);

    
$affiliateSettings AffiliateSetting::create(['point_convert_permission' => 1]);

    
$redeemPoints RedeemPoint::create(['points' => 100'redeem_balance' => 50]);

    
$response $this->actingAs($user)->post(route('frontend.wallet.redeemPoints', ['id' => $redeemPoints->id]));

    
$response->assertStatus(302);

    
$affiliate->refresh();

    
$this->assertEquals(400$affiliate->total_points);
    
$this->assertEquals(50$affiliate->balance);
});

test('it should return 200 status for sign up url with affiliate code', function () {
    
$this->seed(UserSeeder::class);
    
$user User::first();

    
$affiliate Affiliate::create(['user_id' => $user->id'affiliate_code' => rand(100000999999)]);

    
$response $this->get(url('/sign-up/account?aff_code='.$affiliate->affiliate_code));

    
$response->assertStatus(200);
});

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0047 ]--