Skip to content

Commit 6045c24

Browse files
committed
Block Processor: Remove use of NumberFormatter from test suite.
The Block Processor tests call `NumberFormatter` for generating its error messages, but in environments lacking the `intl` extension this led to crashes while running the tests. This patch reworks the tests so that they avoid calling `NumberFormatter` so that the tests run on more diverse setups. Developed in WordPress#10576 Discussed in https://core.trac.wordpress.org/ticket/64329 Follow-up to [60939]. Props desrosj, ellatrix, peterwilsoncc, westonruter. See #64329. git-svn-id: https://develop.svn.wordpress.org/trunk@61342 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 38c3584 commit 6045c24

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/phpunit/tests/block-processor/wpBlockProcessor-BlockProcessing.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,34 @@ public function test_get_depth() {
4949
}
5050

5151
$processor = new WP_Block_Processor( $html );
52-
$n = new NumberFormatter( 'en-US', NumberFormatter::ORDINAL );
5352

5453
for ( $i = 0; $i < $max_depth; $i++ ) {
54+
$nth = $i + 1;
55+
5556
$this->assertTrue(
5657
$processor->next_delimiter(),
57-
"Should have found {$n->format( $i + 1 )} opening delimiter: check test setup."
58+
"Should have found opening delimiter #{$nth}: check test setup."
5859
);
5960

6061
$this->assertSame(
6162
$i + 1,
6263
$processor->get_depth(),
63-
"Should have identified the proper depth of the {$n->format( $i + 1 )} opening delimiter."
64+
"Should have identified the proper depth of opening delimiter #{$nth}."
6465
);
6566
}
6667

6768
for ( $i = 0; $i < $max_depth; $i++ ) {
69+
$nth = $i + 1;
70+
6871
$this->assertTrue(
6972
$processor->next_delimiter(),
70-
"Should have found {$n->format( $i + 1 )} closing delimiter: check test setup."
73+
"Should have found closing delimiter #{$nth}: check test setup."
7174
);
7275

7376
$this->assertSame(
7477
$max_depth - $i - 1,
7578
$processor->get_depth(),
76-
"Should have identified the proper depth of the {$n->format( $i + 1 )} closing delimiter."
79+
"Should have identified the proper depth of closing delimiter #{$nth}."
7780
);
7881
}
7982
}

0 commit comments

Comments
 (0)