Skip to content

Commit

Permalink
TEMP
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Sep 7, 2024
1 parent 5d5867b commit a47123b
Show file tree
Hide file tree
Showing 2 changed files with 226 additions and 0 deletions.
55 changes: 55 additions & 0 deletions TEMP results.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
PHPUnit 9.6.6 by Sebastian Bergmann and contributors.

. 1 / 1 (100%)
=====================
\Yoast\PHPUnitPolyfills\Tests\EndToEnd\TestListeners\Fixtures\TestListenerImplementation::__set_state(array(
'errorCount' => 0,
'warningCount' => 0,
'failureCount' => 0,
'incompleteCount' => 0,
'riskyCount' => 0,
'skippedCount' => 0,
'startSuiteCount' => 3,
'endSuiteCount' => 1,
'startTestCount' => 1,
'endTestCount' => 1,
))

=====================

=====================
\Yoast\PHPUnitPolyfills\Tests\EndToEnd\TestListeners\Fixtures\TestListenerImplementation::__set_state(array(
'errorCount' => 0,
'warningCount' => 0,
'failureCount' => 0,
'incompleteCount' => 0,
'riskyCount' => 0,
'skippedCount' => 0,
'startSuiteCount' => 3,
'endSuiteCount' => 2,
'startTestCount' => 1,
'endTestCount' => 1,
))

=====================

=====================
\Yoast\PHPUnitPolyfills\Tests\EndToEnd\TestListeners\Fixtures\TestListenerImplementation::__set_state(array(
'errorCount' => 0,
'warningCount' => 0,
'failureCount' => 0,
'incompleteCount' => 0,
'riskyCount' => 0,
'skippedCount' => 0,
'startSuiteCount' => 3,
'endSuiteCount' => 3,
'startTestCount' => 1,
'endTestCount' => 1,
))

=====================


Time: 00:00.014, Memory: 18.00 MB

OK (1 test, 1 assertion)
171 changes: 171 additions & 0 deletions tests/Unit/TestListeners/Fixtures/TestListenerImplementation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<?php

namespace Yoast\PHPUnitPolyfills\Tests\Unit\TestListeners\Fixtures;

use PHPUnit\Framework\TestListener;
use Yoast\PHPUnitPolyfills\TestListeners\TestListenerDefaultImplementation;

/**
* TestListener implementation for testing the TestListener cross-version
* TestListenerDefaultImplementation trait.
*/
class TestListenerImplementation implements TestListener {

use TestListenerDefaultImplementation;

/**
* Track how many errors have been encountered.
*
* @var int
*/
private $errorCount = 0;

/**
* Track how many warnings have been encountered.
*
* @var int
*/
private $warningCount = 0;

/**
* Track how many failures have been encountered.
*
* @var int
*/
private $failureCount = 0;

/**
* Track how many incomplete tests have been encountered.
*
* @var int
*/
private $incompleteCount = 0;

/**
* Track how many risky tests have been encountered.
*
* @var int
*/
private $riskyCount = 0;

/**
* Track how many skipped tests have been encountered.
*
* @var int
*/
private $skippedCount = 0;

/**
* Track how many tests have been started.
*
* @var int
*/
private $startTestCount = 0;

/**
* Track how many tests have ended.
*
* @var int
*/
private $endTestCount = 0;

/**
* An error occurred.
*
* @param Test $test Test object.
* @param Exception|Throwable $e Instance of the error encountered.
* @param float $time Execution time of this test.
*/
public function add_error( $test, $e, $time ) {
++$this->errorCount;
}

/**
* A warning occurred.
*
* @param Test $test Test object.
* @param Warning $e Instance of the warning encountered.
* @param float $time Execution time of this test.
*/
public function add_warning( $test, $e, $time ) {
++$this->warningCount;
}

/**
* A failure occurred.
*
* @param Test $test Test object.
* @param AssertionFailedError $e Instance of the assertion failure exception encountered.
* @param float $time Execution time of this test.
*/
public function add_failure( $test, $e, $time ) {
++$this->failureCount;
}

/**
* Incomplete test.
*
* @param Test $test Test object.
* @param Exception|Throwable $e Instance of the incomplete test exception.
* @param float $time Execution time of this test.
*/
public function add_incomplete_test( $test, $e, $time ) {
++$this->incompleteCount;
}

/**
* Risky test.
*
* @param Test $test Test object.
* @param Exception|Throwable $e Instance of the risky test exception.
* @param float $time Execution time of this test.
*/
public function add_risky_test( $test, $e, $time ) {
++$this->riskyCount;
}

/**
* Skipped test.
*
* @param Test $test Test object.
* @param Exception|Throwable $e Instance of the skipped test exception.
* @param float $time Execution time of this test.
*/
public function add_skipped_test( $test, $e, $time ) {
++$this->skippedCount;
}

/**
* A test started.
*
* @param Test $test Test object.
*/
public function start_test( $test ) {
++$this->startTestCount;
}

/**
* A test ended.
*
* @param Test $test Test object.
* @param float $time Execution time of this test.
*/
public function end_test( $test, $time ) {
++$this->endTestCount;
}

/**
* Getter to retrieve the values of the properties.
*
* @param string $name Property name.
*
* @return mixed|null The property value or null if the property does not exist.
*/
public function __get( $name ) {
if ( isset( $this->{$name} ) ) {
return $this->{$name};
}

return null;
}
}

0 comments on commit a47123b

Please sign in to comment.