Skip to content

Commit 74778f8

Browse files
committed
Tests/HasNewLineSupportTest: work round removal of the setOutputCallback() method
PHPUnit 10.0 removed the `TestCase::setOutputCallback()` method without replacement. Refs: * sebastianbergmann/phpunit 5319
1 parent 96c9676 commit 74778f8

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

PHPCSDebug/Tests/Debug/TokenListCssTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ public function testOutput()
113113

114114
EOD;
115115

116-
$this->expectOutputString($expected);
117-
$this->setOutputCallback([$this, 'normalizeLineEndings']);
118-
119116
if (empty(self::$phpcsFile->ruleset->tokenListeners)) {
120117
// PHPCSUtils 1.0.9+.
121118
$sniffFile = \dirname(\dirname(__DIR__)) . \DIRECTORY_SEPARATOR . 'Sniffs';
@@ -127,7 +124,13 @@ public function testOutput()
127124
self::$phpcsFile->ruleset->populateTokenListeners();
128125
}
129126

127+
\ob_start();
130128
self::$phpcsFile->process();
129+
130+
$output = \ob_get_contents();
131+
\ob_end_clean();
132+
133+
$this->assertSame($expected, $this->normalizeLineEndings($output));
131134
}
132135

133136
/**

PHPCSDebug/Tests/Debug/TokenListJsTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ public function testOutput()
133133

134134
EOD;
135135

136-
$this->expectOutputString($expected);
137-
$this->setOutputCallback([$this, 'normalizeLineEndings']);
138-
139136
if (empty(self::$phpcsFile->ruleset->tokenListeners)) {
140137
// PHPCSUtils 1.0.9+.
141138
$sniffFile = \dirname(\dirname(__DIR__)) . \DIRECTORY_SEPARATOR . 'Sniffs';
@@ -147,7 +144,13 @@ public function testOutput()
147144
self::$phpcsFile->ruleset->populateTokenListeners();
148145
}
149146

147+
\ob_start();
150148
self::$phpcsFile->process();
149+
150+
$output = \ob_get_contents();
151+
\ob_end_clean();
152+
153+
$this->assertSame($expected, $this->normalizeLineEndings($output));
151154
}
152155

153156
/**

PHPCSDebug/Tests/Debug/TokenListUnitTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ public function testOutput()
106106

107107
EOD;
108108

109-
$this->expectOutputString($expected);
110-
$this->setOutputCallback([$this, 'normalizeLineEndings']);
111-
112109
if (empty(self::$phpcsFile->ruleset->tokenListeners)) {
113110
// PHPCSUtils 1.0.9+.
114111
$sniffFile = \dirname(\dirname(__DIR__)) . \DIRECTORY_SEPARATOR . 'Sniffs';
@@ -120,7 +117,13 @@ public function testOutput()
120117
self::$phpcsFile->ruleset->populateTokenListeners();
121118
}
122119

120+
\ob_start();
123121
self::$phpcsFile->process();
122+
123+
$output = \ob_get_contents();
124+
\ob_end_clean();
125+
126+
$this->assertSame($expected, $this->normalizeLineEndings($output));
124127
}
125128

126129
/**

0 commit comments

Comments
 (0)