PHP code example of uru / testhub-bundle

1. Go to this page and download the library: Download uru/testhub-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uru / testhub-bundle example snippets


return [
    // ...
    TestHub\Bundle\TestHubBundle::class => ['dev' => true],
];

   use TestHub\Bundle\Service\SandBoxService;

   $httpClient->request('GET', 'https://psp.example/balance', [
       'extra' => [SandBoxService::SANDBOX_TYPE => 'balance'],
   ]);
   

namespace App\Sandbox;

use TestHub\Bundle\HttpClient\State\ContextProviderInterface;

final class CurrentAgentProvider implements ContextProviderInterface
{
    public function __construct(private AgentRepository $agents) {}

    public function get(): array
    {
        return [$this->agents->current()];
    }
}

namespace App\Sandbox;

use TestHub\Bundle\Action\ActionInterface;

final class PayoutAction implements ActionInterface
{
    public function getName(): string { return 'payout'; }
    public function getLabel(): string { return 'Run payout'; }
    public function getDescription(): string { return 'Processes approved withdrawals of a gateway.'; }

    /** Form fields, as name => label. */
    public function getParameters(): array
    {
        return ['provider' => 'Provider', 'gateway' => 'Gateway'];
    }

    public function run(array $parameters): string
    {
        // ...
        return 'Payout finished.';
    }
}