File: run_test.php

package info (click to toggle)
php-phpspec-prophecy-phpunit 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208 kB
  • sloc: php: 197; makefile: 17
file content (25 lines) | stat: -rw-r--r-- 747 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

namespace Prophecy\PhpUnit\Tests;

use PHPUnit\TextUI\Application;
use PHPUnit\TextUI\Command;

require_once __DIR__ . '/xdebug_filter.php';
require_once dirname(__DIR__) . '/vendor/autoload.php';

function runTest(string $fixtureName): void
{
    $filename = dirname(__DIR__) . '/fixtures/' . $fixtureName . '.php';
    if (!file_exists($filename)) {
        throw new \InvalidArgumentException('Unable to find test fixture at path ' . $filename);
    }

    if (class_exists(Command::class)) {
        // PHPUnit 9.x
        (new Command())->run(['phpunit', $filename, '--verbose', '--no-configuration'], false);
    } else {
        // PHPUnit 10.x
        (new Application())->run(['phpunit', $filename, '--no-configuration']);
    }
}