Skip to content

Commit c18b13a

Browse files
committed
Add Behat steps to manifest
1 parent cb605e8 commit c18b13a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

bin/command.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ public function gen_hb_manifest() {
408408
'parent' => null,
409409
];
410410
}
411+
411412
// Internal API pages.
412413
foreach ( glob( WP_CLI_HANDBOOK_PATH . '/internal-api/*.md' ) as $file ) {
413414
$slug = basename( $file, '.md' );
@@ -426,6 +427,26 @@ public function gen_hb_manifest() {
426427
'parent' => 'internal-api',
427428
];
428429
}
430+
431+
// Behat steps pages.
432+
foreach ( glob( WP_CLI_HANDBOOK_PATH . '/behat-steps/*.md' ) as $file ) {
433+
$slug = basename( $file, '.md' );
434+
$title = '';
435+
$contents = file_get_contents( $file );
436+
if ( preg_match( '/^#\s(.+)/', $contents, $matches ) ) {
437+
$title = $matches[1];
438+
}
439+
$manifest[ $slug ] = [
440+
'title' => $title,
441+
'slug' => $slug,
442+
'markdown_source' => sprintf(
443+
'https://github.com/wp-cli/handbook/blob/main/behat-steps/%s.md',
444+
$slug
445+
),
446+
'parent' => 'ibehat-stepsapi',
447+
];
448+
}
449+
429450
file_put_contents( WP_CLI_HANDBOOK_PATH . '/bin/handbook-manifest.json', json_encode( $manifest, JSON_PRETTY_PRINT ) );
430451
WP_CLI::success( 'Generated bin/handbook-manifest.json' );
431452
}

0 commit comments

Comments
 (0)