Skip to content

Commit 32de18d

Browse files
authored
Merge pull request #23 from wp-cli/22-add-given-cache-file-step
Add `Given a ... cache file` step
2 parents 00c487c + f1c84dc commit 32de18d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

features/steps/given.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ function ( $world ) {
4343
);
4444

4545
$steps->Given(
46-
'/^an? ([^\s]+) file:$/',
47-
function ( $world, $path, PyStringNode $content ) {
46+
'/^an? ([^\s]+) (file|cache file):$/',
47+
function ( $world, $path, $type, PyStringNode $content ) {
4848
$content = (string) $content . "\n";
49-
$full_path = $world->variables['RUN_DIR'] . "/$path";
49+
$full_path = 'cache file' === $type
50+
? $world->variables['SUITE_CACHE_DIR'] . "/$path"
51+
: $world->variables['RUN_DIR'] . "/$path";
5052
$dir = dirname( $full_path );
5153
if ( ! file_exists( $dir ) ) {
5254
mkdir( $dir, 0777, true /*recursive*/ );

0 commit comments

Comments
 (0)