Skip to content

Commit

Permalink
Tests/HasNewLineSupportTest: work round removal of the `setOutputCal…
Browse files Browse the repository at this point in the history
…lback()` method

PHPUnit 10.0 removed the `TestCase::setOutputCallback()` method without replacement.

Refs:
* sebastianbergmann/phpunit 5319
  • Loading branch information
jrfnl committed Sep 10, 2024
1 parent 96c9676 commit 74778f8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
9 changes: 6 additions & 3 deletions PHPCSDebug/Tests/Debug/TokenListCssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ public function testOutput()

EOD;

$this->expectOutputString($expected);
$this->setOutputCallback([$this, 'normalizeLineEndings']);

if (empty(self::$phpcsFile->ruleset->tokenListeners)) {
// PHPCSUtils 1.0.9+.
$sniffFile = \dirname(\dirname(__DIR__)) . \DIRECTORY_SEPARATOR . 'Sniffs';
Expand All @@ -127,7 +124,13 @@ public function testOutput()
self::$phpcsFile->ruleset->populateTokenListeners();
}

\ob_start();
self::$phpcsFile->process();

$output = \ob_get_contents();
\ob_end_clean();

$this->assertSame($expected, $this->normalizeLineEndings($output));
}

/**
Expand Down
9 changes: 6 additions & 3 deletions PHPCSDebug/Tests/Debug/TokenListJsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ public function testOutput()

EOD;

$this->expectOutputString($expected);
$this->setOutputCallback([$this, 'normalizeLineEndings']);

if (empty(self::$phpcsFile->ruleset->tokenListeners)) {
// PHPCSUtils 1.0.9+.
$sniffFile = \dirname(\dirname(__DIR__)) . \DIRECTORY_SEPARATOR . 'Sniffs';
Expand All @@ -147,7 +144,13 @@ public function testOutput()
self::$phpcsFile->ruleset->populateTokenListeners();
}

\ob_start();
self::$phpcsFile->process();

$output = \ob_get_contents();
\ob_end_clean();

$this->assertSame($expected, $this->normalizeLineEndings($output));
}

/**
Expand Down
9 changes: 6 additions & 3 deletions PHPCSDebug/Tests/Debug/TokenListUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ public function testOutput()

EOD;

$this->expectOutputString($expected);
$this->setOutputCallback([$this, 'normalizeLineEndings']);

if (empty(self::$phpcsFile->ruleset->tokenListeners)) {
// PHPCSUtils 1.0.9+.
$sniffFile = \dirname(\dirname(__DIR__)) . \DIRECTORY_SEPARATOR . 'Sniffs';
Expand All @@ -120,7 +117,13 @@ public function testOutput()
self::$phpcsFile->ruleset->populateTokenListeners();
}

\ob_start();
self::$phpcsFile->process();

$output = \ob_get_contents();
\ob_end_clean();

$this->assertSame($expected, $this->normalizeLineEndings($output));
}

/**
Expand Down

0 comments on commit 74778f8

Please sign in to comment.