PHP code example of qase / phpunit-reporter

1. Go to this page and download the library: Download qase/phpunit-reporter 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/ */

    

qase / phpunit-reporter example snippets




namespace Tests;

use Exception;
use PHPUnit\Framework\TestCase;
use Qase\PHPUnitReporter\Attributes\Field;
use Qase\PHPUnitReporter\Attributes\Parameter;
use Qase\PHPUnitReporter\Attributes\QaseId;
use Qase\PHPUnitReporter\Attributes\Suite;
use Qase\PHPUnitReporter\Attributes\Title;
use Qase\PHPUnitReporter\Qase;

#[Suite("Main suite")]
class SimplesTest extends TestCase
{
    #[
        Title('Test one'),
        Parameter("param1", "value1"),
    ]
    public function testOne(): void
    {
        Qase::comment("My comment");
        $this->assertTrue(true);
    }

    #[
        QaseId(123),
        Field('description', 'Some description'),
        Field('severity', 'major')
    ]
    public function testTwo(): void
    {
        Qase::attach("/my_path/file.json");
        $this->assertTrue(false);
    }

    #[
        Suite('Suite one'),
        Suite('Suite two')
    ]
    public function testThree(): void
    {
        Qase::attach((object) ['title' => 'attachment.txt', 'content' => 'Some string', 'mime' => 'text/plain']);
        throw new Exception('Some exception');
    }
}