diff --git a/PHPCSDebug/Tests/Debug/TokenListCssTest.php b/PHPCSDebug/Tests/Debug/TokenListCssTest.php index ae391d4..202792d 100644 --- a/PHPCSDebug/Tests/Debug/TokenListCssTest.php +++ b/PHPCSDebug/Tests/Debug/TokenListCssTest.php @@ -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'; @@ -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)); } /** diff --git a/PHPCSDebug/Tests/Debug/TokenListJsTest.php b/PHPCSDebug/Tests/Debug/TokenListJsTest.php index 1c308f0..1d1c806 100644 --- a/PHPCSDebug/Tests/Debug/TokenListJsTest.php +++ b/PHPCSDebug/Tests/Debug/TokenListJsTest.php @@ -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'; @@ -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)); } /** diff --git a/PHPCSDebug/Tests/Debug/TokenListUnitTest.php b/PHPCSDebug/Tests/Debug/TokenListUnitTest.php index 3cbed60..2dd1292 100644 --- a/PHPCSDebug/Tests/Debug/TokenListUnitTest.php +++ b/PHPCSDebug/Tests/Debug/TokenListUnitTest.php @@ -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'; @@ -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)); } /**