Skip to content

Commit

Permalink
Move testing file to templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Mar 21, 2024
1 parent f73d47a commit d675e90
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 14 additions & 0 deletions features/scaffold-package-tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@ Feature: Scaffold the test suite for an existing package
"""
And the community-command/.travis.yml file should not exist

Scenario: Scaffolds Github Actions configuration file with argument
When I run `wp scaffold package-tests community-command --ci=github`
Then STDOUT should not be empty
And the community-command/.github/workflows/testing.yml file should exist
And the community-command/.github/workflows/testing.yml file should contain:
"""
composer behat
"""
And the community-command/.github/workflows/testing.yml file should contain:
"""
actions/checkout
"""
And the community-command/.travis.yml file should not exist

Scenario: Don't scaffold features/load-wp-cli.feature when a feature file already exists
When I run `wp scaffold package-tests community-command`
And I run `mv community-command/features/load-wp-cli.feature community-command/features/command.feature`
Expand Down
4 changes: 2 additions & 2 deletions src/ScaffoldPackageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,8 @@ public function package_tests( $args, $assoc_args ) {
} elseif ( 'circle' === $assoc_args['ci'] ) {
$copy_source[ $package_root ]['.circleci/config.yml'] = $package_dir . '.circleci/';
} elseif ( 'github' === $assoc_args['ci'] ) {
$copy_source[ $package_root ]['dot-github/workflows/testing.yml'] = $package_dir . '.github/workflows/';
$copy_source[ $package_root ]['behat.yml'] = $package_dir;
$copy_source[ $package_root ]['templates/testing.yml'] = $package_dir . '.github/workflows/';
$copy_source[ $package_root ]['behat.yml'] = $package_dir;
}

$files_written = [];
Expand Down
4 changes: 2 additions & 2 deletions dot-github/workflows/testing.yml → templates/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
behat:
strategy:
matrix:
php-version: ['8.0', '7.4']
php-version: ['8.2', '8.0', '7.4']
runs-on: ubuntu-latest
services:
mysql:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
run: composer install

- name: Run Behat
run: composer run behat
run: composer behat
env:
WP_CLI_TEST_DBUSER: wp_cli_test
WP_CLI_TEST_DBPASS: password1
Expand Down

0 comments on commit d675e90

Please sign in to comment.