-
Notifications
You must be signed in to change notification settings - Fork 1
Added tests for tables command and testing docs #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0be80ab
Added tests for tables command and testing docs
fredrikekelund 088035f
Stop running tests as cron job
fredrikekelund 96aeaad
Dummy
fredrikekelund 1c00868
Revert "Dummy"
fredrikekelund 6de86ee
Intentionally break test
fredrikekelund 04b029c
Revert "Intentionally break test"
fredrikekelund File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Testing | ||
|
|
||
| This repo uses the [BDD](https://en.wikipedia.org/wiki/Behavior-driven_development) testing framework [Behat](https://docs.behat.org/en/latest/). It means we use plain text files to describe "scenarios" containing keywords like "given", "when", and "then". This methodology was [chosen](https://github.com/Automattic/wp-cli-sqlite-command/issues/3) because it's what WP CLI itself uses to [test commands](https://github.com/wp-cli/wp-cli-tests). | ||
|
|
||
| The test cases are located in `features/*.feature`. | ||
|
|
||
| ## Running tests locally | ||
|
|
||
| The test cases depend on real WordPress installations, meaning the usual PHP and MySQL dependencies are required. However, we can opt to use SQLite instead of MySQL to make running the tests locally easier. Here's how to run the full test suite with a SQLite database: | ||
|
|
||
| ``` | ||
| WP_CLI_TEST_DBTYPE=sqlite vendor/bin/behat | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| Feature: WP-CLI SQLite Tables Command | ||
| In order to export individual tables from a WordPress SQLite table | ||
| As a website administrator | ||
| I need to be able to list the tables contained in the database | ||
|
|
||
| Background: | ||
| Given a WP installation | ||
|
|
||
| @require-sqlite | ||
| Scenario: Successfully list the tables in the SQLite database | ||
| When I run `wp sqlite tables` | ||
| Then STDOUT should contain: | ||
| """ | ||
| wp_users | ||
| wp_usermeta | ||
| wp_termmeta | ||
| wp_terms | ||
| wp_term_taxonomy | ||
| wp_term_relationships | ||
| wp_commentmeta | ||
| wp_comments | ||
| wp_links | ||
| wp_options | ||
| wp_postmeta | ||
| wp_posts | ||
| """ | ||
|
|
||
| @require-sqlite | ||
| Scenario: Successfully list the tables in the SQLite database in a CSV format | ||
| When I run `wp sqlite tables --format=csv` | ||
| Then STDOUT should contain: | ||
| """ | ||
| wp_users,wp_usermeta,wp_termmeta,wp_terms,wp_term_taxonomy,wp_term_relationships,wp_commentmeta,wp_comments,wp_links,wp_options,wp_postmeta,wp_posts | ||
| """ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I missed that before, and I was running those tests by providing a path to MySQL.