1. Go to this page and download the library: Download rapira/testing 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/ */
rapira / testing example snippets
use Rapira\Sdk\Testing\Testo\RunRapiraPlugin;
use Testo\Application\Config\ApplicationConfig;
use Testo\Application\Config\Plugin\SuitePlugins;
use Testo\Application\Config\SuiteConfig;
return new ApplicationConfig(
src: ['src'],
suites: [
new SuiteConfig(
name: 'Integration',
location: ['tests/Integration'],
plugins: SuitePlugins::with(new RunRapiraPlugin(
binary: __DIR__ . '/runtime/bin/rapira',
workingDirectory: __DIR__ . '/tests/Integration/App',
)),
),
],
);
use Rapira\Sdk\Common\Mode;
use Rapira\Sdk\Testing\Testo\Attribute\RunRapira;
use Testo\Attribute\Test;
#[RunRapira(mode: Mode::Worker, worker: 'worker.php', address: '127.0.0.1:8080')]
final class WorkerTest
{
#[Test]
public function respondsToRequests(): void
{
$response = file_get_contents('http://127.0.0.1:8080/');
// ...assertions on $response
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.