403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.145.199.113
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wavevlvu/./book24.ng/vendor/bavix/laravel-wallet/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/./book24.ng/vendor/bavix/laravel-wallet/tests/ConfirmMockTest.php
<?php

namespace Bavix\Wallet\Test;

use Bavix\Wallet\Services\WalletService;
use Bavix\Wallet\Test\Common\Models\Wallet;
use Bavix\Wallet\Test\Factories\UserConfirmFactory;
use Bavix\Wallet\Test\Models\UserConfirm;

class ConfirmMockTest extends TestCase
{
    /**
     * @return void
     */
    public function testFailConfirm(): void
    {
        /**
         * @var UserConfirm $userConfirm
         */
        $userConfirm = UserConfirmFactory::new()->create();
        $transaction = $userConfirm->deposit(100, null, false);
        self::assertEquals($userConfirm->wallet->id, $transaction->wallet->id);
        self::assertEquals($userConfirm->id, $transaction->payable_id);
        self::assertInstanceOf(UserConfirm::class, $transaction->payable);
        self::assertFalse($transaction->confirmed);

        $wallet = app(WalletService::class)
            ->getWallet($userConfirm);

        $mockWallet = $this->createMock(\get_class($wallet));
        $mockWallet->method('refreshBalance')
            ->willReturn(false);

        /**
         * @var Wallet $mockWallet
         */
        self::assertInstanceOf(Wallet::class, $wallet);
        self::assertFalse($mockWallet->refreshBalance());

        $userConfirm->setRelation('wallet', $mockWallet);
        self::assertFalse($userConfirm->confirm($transaction));
        self::assertFalse($userConfirm->safeConfirm($transaction));
    }

    /**
     * @return void
     */
    public function testFailResetConfirm(): void
    {
        /**
         * @var UserConfirm $userConfirm
         */
        $userConfirm = UserConfirmFactory::new()->create();
        $transaction = $userConfirm->deposit(100);
        self::assertEquals($userConfirm->wallet->id, $transaction->wallet->id);
        self::assertEquals($userConfirm->id, $transaction->payable_id);
        self::assertInstanceOf(UserConfirm::class, $transaction->payable);
        self::assertTrue($transaction->confirmed);

        $wallet = app(WalletService::class)
            ->getWallet($userConfirm);

        $mockWallet = $this->createMock(\get_class($wallet));
        $mockWallet->method('refreshBalance')
            ->willReturn(false);

        /**
         * @var Wallet $mockWallet
         */
        self::assertInstanceOf(Wallet::class, $wallet);
        self::assertFalse($mockWallet->refreshBalance());

        $userConfirm->setRelation('wallet', $mockWallet);
        self::assertFalse($userConfirm->resetConfirm($transaction));
        self::assertFalse($userConfirm->safeResetConfirm($transaction));
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit