Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
matrix:
php: [ 8.2, 8.3, 8.4, 8.5 ]
dependencies: [ lowest , highest ]
include:
- php: 8.1
dependencies: highest
max-parallel: 2

name: Tests PHP${{ matrix.php }}-${{ matrix.dependencies }}
Expand All @@ -52,10 +55,19 @@ jobs:
coverage: none

- name: Install Composer dependencies
if: matrix.php != '8.1'
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}

- name: Install and downgrade for PHP 8.1
if: matrix.php == '8.1'
uses: php-internal/actions/downgrade@v1
with:
php-version: '8.1'
dependency-versions: ${{ matrix.dependencies }}
paths: core plugin bridge tests testo.php

# Bin tools carry deps with a higher PHP floor than the matrix (e.g. tools/double).
# They install everywhere but only load where the platform allows, so ignore the check.
- name: Install bin tools
Expand Down
2 changes: 1 addition & 1 deletion bridge/symfony-console/src/Command/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
)]
final class Init extends Command
{
private const STUB = __DIR__ . '/../../resources/stubs/testo.php';
private const STUB = __DIR__ . '/../../resources/stubs/testo.php.stub';
private const CONFIG_FILENAME = 'testo.php';
private const KNOWN_SUITES = ['Unit', 'Integration', 'Functional', 'Acceptance', 'Feature', 'E2E', 'Contract'];
private const SCRIPT_ALL_KEY = 'test';
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"require": {
"php": ">=8.2",
"ext-tokenizer": "*",
"internal/container": "^1.0",
"internal/container": "^1.1",
"internal/destroy": "^1.0",
"internal/path": "^1.3",
"psr/container": "1 - 2",
Expand Down
2 changes: 2 additions & 0 deletions core/Application/Config/ApplicationConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Application\Config;

use Internal\Container\Attribute\ScopeShared;
use Internal\Path;
use Testo\Application\Config\Plugin\ApplicationPlugins;
use Testo\Common\PluginConfigurator;
Expand All @@ -13,6 +14,7 @@
*
* @api
*/
#[ScopeShared]
final readonly class ApplicationConfig
{
/**
Expand Down
2 changes: 2 additions & 0 deletions core/Application/Config/RunConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Application\Config;

use Internal\Container\Attribute\ScopeShared;
use Internal\Path;

/**
Expand All @@ -22,6 +23,7 @@
* @psalm-immutable
* @api
*/
#[ScopeShared]
final readonly class RunConfiguration
{
/**
Expand Down
2 changes: 2 additions & 0 deletions core/Application/Internal/MessengerHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Application\Internal;

use Internal\Container\Attribute\ScopeShared;
use Psr\EventDispatcher\EventDispatcherInterface;
use Testo\Application\Internal\Messenger\State;
use Testo\Application\Internal\Messenger\MutableContainer;
Expand All @@ -23,6 +24,7 @@
*
* @internal
*/
#[ScopeShared]
final readonly class MessengerHub implements Messenger
{
private MutableContainer $state;
Expand Down
2 changes: 2 additions & 0 deletions core/Application/Internal/Runner/CaseRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Application\Internal\Runner;

use Internal\Container\Attribute\ScopeShared;
use Psr\EventDispatcher\EventDispatcherInterface;
use Testo\Core\Context\CaseInfo;
use Testo\Core\Context\CaseResult;
Expand All @@ -25,6 +26,7 @@
* @internal
* @psalm-internal Testo\Application
*/
#[ScopeShared]
final readonly class CaseRunner
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions core/Application/Internal/Runner/SuiteRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Application\Internal\Runner;

use Internal\Container\Attribute\ScopeShared;
use Psr\EventDispatcher\EventDispatcherInterface;
use Testo\Application\Internal\SimpleCaseInstantiator;
use Testo\Common\ErrorReporter;
Expand All @@ -30,6 +31,7 @@
* @internal
* @psalm-internal Testo\Application
*/
#[ScopeShared]
final readonly class SuiteRunner
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions core/Application/Internal/Runner/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Application\Internal\Runner;

use Internal\Container\Attribute\ScopeShared;
use Psr\EventDispatcher\EventDispatcherInterface;
use Testo\Application\Exception\PipelineFailure;
use Testo\Core\Context\TestInfo;
Expand Down Expand Up @@ -37,6 +38,7 @@
* @internal
* @psalm-internal Testo\Application
*/
#[ScopeShared]
final readonly class TestRunner
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions core/Common/ErrorReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Common;

use Internal\Container\Attribute\ScopeShared;
use Testo\Core\Log\Level;

/**
Expand All @@ -17,6 +18,7 @@
*
* @internal
*/
#[ScopeShared]
final readonly class ErrorReporter
{
public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions core/Output/ConsoleStreams.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Testo\Output;

use Internal\Container\Attribute\ScopeShared;

/**
* The process's stdout/stderr as an injectable pair of streams.
*
Expand All @@ -12,6 +14,7 @@
*
* @api
*/
#[ScopeShared]
final readonly class ConsoleStreams
{
/** @var resource */
Expand Down
2 changes: 2 additions & 0 deletions core/Pipeline/Internal/AttributesInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Pipeline\Internal;

use Internal\Container\Attribute\ScopeShared;
use Testo\Common\Reflection;
use Testo\Core\Context\CaseInfo;
use Testo\Core\Context\CaseResult;
Expand All @@ -25,6 +26,7 @@
* @psalm-internal Testo\Pipeline
*/
#[InterceptorOptions(order: InterceptorOptions::ORDER_ATTRIBUTES)]
#[ScopeShared]
final readonly class AttributesInterceptor implements TestRunInterceptor, TestCaseRunInterceptor
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions core/Testing/Internal/InjectInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Testing\Internal;

use Internal\Container\Attribute\ScopeShared;
use Internal\Container\Container;
use Testo\Core\Context\CaseInfo;
use Testo\Core\Context\CaseResult;
Expand All @@ -21,6 +22,7 @@
* @psalm-internal Testo
*/
#[InterceptorOptions(order: InterceptorOptions::ORDER_DEFAULT)]
#[ScopeShared]
final readonly class InjectInterceptor implements TestCaseRunInterceptor
{
public function __construct(
Expand Down
1 change: 1 addition & 0 deletions plugin/assert/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
],
"require": {
"php": ">=8.2",
"internal/container": "^1.1",
"testo/testo": "0.10.44 - 1"
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Assert\Internal\Middleware;

use Internal\Container\Attribute\ScopeShared;
use Testo\Assert\AssertPlugin;
use Testo\Assert\Internal\HistoryRenderer;
use Testo\Assert\Internal\StaticState;
Expand All @@ -28,6 +29,7 @@
* Supports both synchronous and asynchronous (Fiber-based) environments.
*/
#[InterceptorOptions(order: InterceptorOptions::ORDER_ASSERTIONS - 10)]
#[ScopeShared]
final readonly class AssertCollectorInterceptor implements TestRunInterceptor
{
public function __construct(
Expand Down
1 change: 1 addition & 0 deletions plugin/bench/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
],
"require": {
"php": ">=8.2",
"internal/container": "^1.1",
"testo/data": "^0.1.9",
"testo/filter": "^0.1.7",
"testo/inline": "^0.1.9",
Expand Down
4 changes: 3 additions & 1 deletion plugin/bench/src/Internal/BenchHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Bench\Internal;

use Internal\Container\Attribute\ScopeShared;
use Testo\Assert\Internal\StaticState;
use Testo\Assert\State\Assertion\AssertionException;
use Testo\Assert\State\Assertion\AssertionSuccess;
Expand All @@ -21,6 +22,7 @@
/**
* @internal
*/
#[ScopeShared]
final readonly class BenchHandler
{
public function __construct(
Expand Down Expand Up @@ -239,7 +241,7 @@ private static function runCase(\Closure $function, int $calls): Snap
# peak is reset first so it reflects this iteration only, and the collection cycle keeps
# garbage from a previous case out of the window.
\gc_collect_cycles();
\memory_reset_peak_usage();
\function_exists('memory_reset_peak_usage') and \memory_reset_peak_usage();
$beforeMem = \memory_get_peak_usage();
$beforeTime = \hrtime(true);
for ($i = 0; $i < $calls; ++$i) {
Expand Down
2 changes: 2 additions & 0 deletions plugin/bench/src/Internal/Pipeline/BenchFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Bench\Internal\Pipeline;

use Internal\Container\Attribute\ScopeShared;
use Testo\Bench;
use Testo\Bench\Internal\BenchHandler;
use Testo\Common\Reflection;
Expand All @@ -22,6 +23,7 @@
* @internal
*/
#[InterceptorOptions(order: -20_000, testType: TestType::BenchInline)]
#[ScopeShared]
final readonly class BenchFinder implements FileLocatorInterceptor, CaseLocatorInterceptor
{
/** @var \Closure(TestInfo): mixed Invoker for the test method. */
Expand Down
1 change: 1 addition & 0 deletions plugin/codecov/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"require": {
"php": ">=8.2",
"ext-xmlwriter": "*",
"internal/container": "^1.1",
"testo/data": "^0.1.9",
"testo/inline": "^0.1.8",
"testo/testo": "0.10.44 - 1"
Expand Down
2 changes: 2 additions & 0 deletions plugin/codecov/src/Internal/CoverageCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Codecov\Internal;

use Internal\Container\Attribute\ScopeShared;
use Internal\Destroy\Destroyable;
use Psr\EventDispatcher\EventDispatcherInterface;
use Testo\Codecov\Result\CoverageResult;
Expand All @@ -21,6 +22,7 @@
*
* @internal
*/
#[ScopeShared]
final readonly class CoverageCollector implements Destroyable
{
private Cache $cache;
Expand Down
2 changes: 2 additions & 0 deletions plugin/filter/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo;

use Internal\Container\Attribute\ScopeShared;
use Internal\Path;
use Testo\Core\Value\TestType;

Expand All @@ -15,6 +16,7 @@
*
* @api
*/
#[ScopeShared]
final readonly class Filter
{
/**
Expand Down
1 change: 1 addition & 0 deletions plugin/filter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
],
"require": {
"php": ">=8.2",
"internal/container": "^1.1",
"testo/testo": "0.10.46 - 1"
},
"autoload": {
Expand Down
2 changes: 2 additions & 0 deletions plugin/filter/src/Internal/SuiteFilterInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Testo\Filter\Internal;

use Internal\Container\Attribute\ScopeShared;
use Internal\Path;
use Testo\Application\Config\ApplicationConfig;
use Testo\Application\Config\FinderConfig;
Expand All @@ -23,6 +24,7 @@
* @psalm-internal Testo\Filter
*/
#[InterceptorOptions(order: InterceptorOptions::ORDER_FILTER, onConflict: ConflictPolicy::First)]
#[ScopeShared]
final readonly class SuiteFilterInterceptor implements SuiteLocatorInterceptor
{
public function __construct(
Expand Down
5 changes: 5 additions & 0 deletions tests/Output/Unit/Rendering/Diff/DifferStrategiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Testo\Assert;
use Testo\Codecov\Covers;
use Testo\Core\Exception\SkipTest;
use Testo\Data\DataCross;
use Testo\Data\DataProvider;
use Testo\Output\Rendering\Diff\DiffLine;
Expand Down Expand Up @@ -242,6 +243,10 @@ public function ratcliffStaysCorrectWithPopularLines(): void
*/
public function hirschbergUsesFarLessMemoryThanTheLcsTable(): void
{
\function_exists('memory_reset_peak_usage') or throw new SkipTest(
'Per-call peak measurement needs memory_reset_peak_usage() (PHP 8.2+).',
);

$expected = \implode("\n", \array_map(static fn(int $i): string => "row {$i}", \range(1, 400)));
$actual = \str_replace('row 200', 'row CHANGED', $expected);

Expand Down
Loading