Skip to content

Commit 93eeddb

Browse files
committed
Add a way to test that the arguments are extracted.
1 parent 7c1bf8d commit 93eeddb

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tests/phpunit/includes/export-testcase.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ protected function assertEntityContains( $entity, $type, $expected ) {
5959
foreach ( $entity[ $type ] as $exported ) {
6060
if ( $exported['line'] == $expected['line'] ) {
6161
foreach ( $expected as $key => $expected_value ) {
62-
$this->assertEquals( $expected_value, $exported[ $key ] );
62+
if ( isset( $exported[ $key ] ) ) {
63+
$exported_value = $exported[ $key ];
64+
} else {
65+
$exported_value = _wp_array_get( $exported, explode( '.', $key ), null );
66+
}
67+
68+
$this->assertEquals( $expected_value, $exported_value );
6369
}
6470

6571
return;

tests/phpunit/tests/export/hooks.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ public function test_hook_names_standardized() {
3737
);
3838

3939
$this->assertFileContainsHook(
40-
array( 'type' => 'apply_filters', 'name' => 'plain_filter', 'line' => 8 )
40+
array(
41+
'type' => 'filter',
42+
'name' => 'plain_filter',
43+
'line' => 8,
44+
'arguments.0' => '$variable',
45+
'arguments.1' => '$filter_context'
46+
)
4147
);
4248
}
4349
}

0 commit comments

Comments
 (0)