Skip to content

Commit ceaee6c

Browse files
committed
Remove call to PHPUnit's internal method setOutputCallback()
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 9be8f67 commit ceaee6c

3 files changed

Lines changed: 9 additions & 28 deletions

File tree

psalm-baseline.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17492,15 +17492,7 @@
1749217492
<code><![CDATA[$GLOBALS['plugin_param']['single_table']]]></code>
1749317493
</PossiblyInvalidArrayOffset>
1749417494
</file>
17495-
<file src="test/classes/Plugins/Export/ExportOdsTest.php">
17496-
<InternalMethod>
17497-
<code>setOutputCallback</code>
17498-
</InternalMethod>
17499-
</file>
1750017495
<file src="test/classes/Plugins/Export/ExportOdtTest.php">
17501-
<InternalMethod>
17502-
<code>setOutputCallback</code>
17503-
</InternalMethod>
1750417496
<InvalidArrayOffset>
1750517497
<code><![CDATA[$GLOBALS['foo_columns']]]></code>
1750617498
</InvalidArrayOffset>

test/classes/Plugins/Export/ExportOdsTest.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
use ReflectionProperty;
2424
use stdClass;
2525

26+
use function bin2hex;
27+
2628
use const MYSQLI_BLOB_FLAG;
2729
use const MYSQLI_TYPE_DATE;
2830
use const MYSQLI_TYPE_DATETIME;
@@ -177,20 +179,12 @@ public function testExportHeader(): void
177179
public function testExportFooter(): void
178180
{
179181
$GLOBALS['ods_buffer'] = 'header';
180-
181-
$this->expectOutputRegex('/^504b.*636f6e74656e742e786d6c/');
182-
$this->setOutputCallback('bin2hex');
183-
184-
$this->assertTrue(
185-
$this->object->exportFooter()
186-
);
187-
182+
$this->assertTrue($this->object->exportFooter());
183+
$output = $this->getActualOutputForAssertion();
184+
$this->assertMatchesRegularExpression('/^504b.*636f6e74656e742e786d6c/', bin2hex($output));
188185
$this->assertStringContainsString('header', $GLOBALS['ods_buffer']);
189-
190186
$this->assertStringContainsString('</office:spreadsheet>', $GLOBALS['ods_buffer']);
191-
192187
$this->assertStringContainsString('</office:body>', $GLOBALS['ods_buffer']);
193-
194188
$this->assertStringContainsString('</office:document-content>', $GLOBALS['ods_buffer']);
195189
}
196190

test/classes/Plugins/Export/ExportOdtTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use stdClass;
2626

2727
use function __;
28+
use function bin2hex;
2829

2930
use const MYSQLI_BLOB_FLAG;
3031
use const MYSQLI_NUM_FLAG;
@@ -313,16 +314,10 @@ public function testExportHeader(): void
313314
public function testExportFooter(): void
314315
{
315316
$GLOBALS['odt_buffer'] = 'header';
316-
317-
$this->expectOutputRegex('/^504b.*636f6e74656e742e786d6c/');
318-
$this->setOutputCallback('bin2hex');
319-
320-
$this->assertTrue(
321-
$this->object->exportFooter()
322-
);
323-
317+
$this->assertTrue($this->object->exportFooter());
318+
$output = $this->getActualOutputForAssertion();
319+
$this->assertMatchesRegularExpression('/^504b.*636f6e74656e742e786d6c/', bin2hex($output));
324320
$this->assertStringContainsString('header', $GLOBALS['odt_buffer']);
325-
326321
$this->assertStringContainsString(
327322
'</office:text></office:body></office:document-content>',
328323
$GLOBALS['odt_buffer']

0 commit comments

Comments
 (0)