#42098 closed enhancement (fixed)
Simplify output tests with expectOutputString()
| Reported by: | birgire | Owned by: | johnbillion |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.1 |
| Component: | Build/Test Tools | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
PHPUnit has methods to test output, e.g.:
expectOutputString() expectOutputRegex()
We could use them to simplify tests.
Example:
Before:
ob_start(); the_post_thumbnail(); $actual = ob_get_clean(); $this->assertEquals( '', $actual );
After:
$this->expectOutputString( '' ); the_post_thumbnail();
Currently used in files:
tests/phpunit/tests/general/template.php tests/phpunit/tests/general/document-title.php tests/phpunit/tests/general/resourceHints.php tests/phpunit/tests/oembed/WpEmbed.php
We could scope this ticket to e.g. the files:
tests/phpunit/tests/post/thumbnails.php tests/phpunit/tests/post/listPages.php tests/phpunit/tests/user/listAuthors.php tests/phpunit/tests/functions/getArchives.php tests/phpunit/tests/taxonomy.php
to begin with.
Attachments (1)
Change History (5)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 42098.diff simplifies output tests in: