Skip to content

Commit fff0d40

Browse files
committed
Tests: Ensure default icons exist for rendering tests.
Register the default icon collection and icons when missing in `Tests_Icons_WpGetIcon::set_up()`, so rendering checks have their required fixtures regardless of test order. Developed in: #14101 Props huzaifaalmesbah. See #65893. git-svn-id: https://develop.svn.wordpress.org/trunk@64279 602fd350-edb4-49c9-b593-d223f7449a82
1 parent ca2204c commit fff0d40

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎tests/phpunit/tests/icons/wpGetIcon.php‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@
1212
*/
1313
class Tests_Icons_WpGetIcon extends WP_UnitTestCase {
1414

15+
public function set_up() {
16+
parent::set_up();
17+
18+
/*
19+
* Other suites reset the icon registries, wiping collections and icons that
20+
* `init` only registers once. Re-register them when missing so order-dependent
21+
* tests pass.
22+
*/
23+
if ( ! WP_Icon_Collections_Registry::get_instance()->is_registered( 'core' ) ) {
24+
_wp_register_default_icon_collections();
25+
}
26+
if ( ! WP_Icons_Registry::get_instance()->is_registered( 'core/plus' ) ) {
27+
_wp_register_default_icons();
28+
}
29+
}
30+
1531
/**
1632
* @ticket 64847
1733
*/

0 commit comments

Comments
 (0)