| 1 |
<?php |
| 2 |
declare( strict_types = 1 ); |
| 3 |
|
| 4 |
namespace Wikimedia\Parsoid\ParserTests; |
| 5 |
|
| 6 |
class Stats { |
| 7 |
/** @var float */ |
| 8 |
public $startTime; |
| 9 |
|
| 10 |
/** @var Stats[] */ |
| 11 |
public $modes; |
| 12 |
|
| 13 |
/** @var int */ |
| 14 |
public $passedTests = 0; |
| 15 |
|
| 16 |
/** @var int */ |
| 17 |
public $passedTestsUnexpected = 0; |
| 18 |
|
| 19 |
/** @var int */ |
| 20 |
public $failedTests = 0; |
| 21 |
|
| 22 |
/** @var int */ |
| 23 |
public $failedTestsUnexpected = 0; |
| 24 |
|
| 25 |
/** @var int */ |
| 26 |
public $loggedErrorCount = 0; |
| 27 |
|
| 28 |
/** @var int */ |
| 29 |
public $failures = 0; |
| 30 |
|
| 31 |
/** @var array Array of elements representing test failures */ |
| 32 |
public $failList; |
| 33 |
|
| 34 |
/** @var string result */ |
| 35 |
public $result; |
| 36 |
|
| 37 |
public function __construct() { |
| 38 |
$this->startTime = microtime( true ); |
| 39 |
} |
| 40 |
|
| 41 |
public function allFailures(): int { |
| 42 |
$this->failures = $this->passedTestsUnexpected + |
| 43 |
$this->failedTestsUnexpected + $this->loggedErrorCount; |
| 44 |
|
| 45 |
return $this->failures; |
| 46 |
} |
| 47 |
|
| 48 |
public function accum( Stats $other ): void { |
| 49 |
$this->passedTests += $other->passedTests; |
| 50 |
$this->passedTestsUnexpected += $other->passedTestsUnexpected; |
| 51 |
$this->failedTests += $other->failedTests; |
| 52 |
$this->failedTestsUnexpected += $other->failedTestsUnexpected; |
| 53 |
$this->loggedErrorCount += $other->loggedErrorCount; |
| 54 |
$this->failures += $other->failures; |
| 55 |
} |
| 56 |
} |