Skip to content

Commit

Permalink
Add tests for version requirements added to shortened package identif…
Browse files Browse the repository at this point in the history
…iers.

See #20
  • Loading branch information
schlessera committed Aug 6, 2017
1 parent 3ad38ed commit 6f6e5eb
Showing 1 changed file with 185 additions and 9 deletions.
194 changes: 185 additions & 9 deletions features/package-install.feature
Original file line number Diff line number Diff line change
Expand Up @@ -174,31 +174,75 @@ Feature: Install WP-CLI packages
Scenario: Install a package from Git using a shortened package identifier
Given an empty directory

When I run `wp package install wp-cli/google-sitemap-generator-cli`
When I run `wp package install schlessera/test-command`
Then STDOUT should contain:
"""
Installing package wp-cli/google-sitemap-generator-cli (dev-master)
Installing package schlessera/test-command (dev-master)
Updating {PACKAGE_PATH}composer.json to require the package...
Registering [email protected]:wp-cli/google-sitemap-generator-cli.git as a VCS repository...
Registering [email protected]:schlessera/test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
"""
Success: Package installed.
"""

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name | version |
| schlessera/test-command | dev-master |

When I run `wp test-command`
Then STDOUT should contain:
"""
Success: Version E.
"""

When I run `wp package uninstall schlessera/test-command`
Then STDOUT should contain:
"""
Removing require statement from {PACKAGE_PATH}composer.json
"""
And STDOUT should contain:
"""
Success: Uninstalled package.
"""

When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
schlessera/test-command
"""

@github-api @shortened
Scenario: Install a package from Git using a shortened package identifier with a version requirement
Given an empty directory

When I run `wp package install schlessera/test-command:^0`
Then STDOUT should contain:
"""
Installing package schlessera/test-command (^0)
Updating {PACKAGE_PATH}composer.json to require the package...
Registering [email protected]:schlessera/test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
"""
Success: Package installed.
"""

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name |
| wp-cli/google-sitemap-generator-cli |
| name | version |
| schlessera/test-command | v0.2.0 |

When I run `wp google-sitemap`
When I run `wp test-command`
Then STDOUT should contain:
"""
usage: wp google-sitemap rebuild
Success: Version C.
"""

When I run `wp package uninstall wp-cli/google-sitemap-generator-cli`
When I run `wp package uninstall schlessera/test-command`
Then STDOUT should contain:
"""
Removing require statement from {PACKAGE_PATH}composer.json
Expand All @@ -211,7 +255,139 @@ Feature: Install WP-CLI packages
When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
wp-cli/google-sitemap-generator-cli
schlessera/test-command
"""

@github-api @shortened
Scenario: Install a package from Git using a shortened package identifier with a specific version
Given an empty directory

When I run `wp package install schlessera/test-command:0.1.0`
Then STDOUT should contain:
"""
Installing package schlessera/test-command (0.1.0)
Updating {PACKAGE_PATH}composer.json to require the package...
Registering [email protected]:schlessera/test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
"""
Success: Package installed.
"""

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name | version |
| schlessera/test-command | v0.1.0 |

When I run `wp test-command`
Then STDOUT should contain:
"""
Success: Version A.
"""

When I run `wp package uninstall schlessera/test-command`
Then STDOUT should contain:
"""
Removing require statement from {PACKAGE_PATH}composer.json
"""
And STDOUT should contain:
"""
Success: Uninstalled package.
"""

When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
schlessera/test-command
"""

@github-api @shortened
Scenario: Install a package from Git using a shortened package identifier and a specific commit hash
Given an empty directory

When I run `wp package install schlessera/test-command:dev-master#8e99bba16a65a3cde7405178a6badbb49349f554`
Then STDOUT should contain:
"""
Installing package schlessera/test-command (dev-master#8e99bba16a65a3cde7405178a6badbb49349f554)
Updating {PACKAGE_PATH}composer.json to require the package...
Registering [email protected]:schlessera/test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
"""
Success: Package installed.
"""

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name | version |
| schlessera/test-command | dev-master |

When I run `wp test-command`
Then STDOUT should contain:
"""
Success: Version B.
"""

When I run `wp package uninstall schlessera/test-command`
Then STDOUT should contain:
"""
Removing require statement from {PACKAGE_PATH}composer.json
"""
And STDOUT should contain:
"""
Success: Uninstalled package.
"""

When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
schlessera/test-command
"""

@github-api @shortened
Scenario: Install a package from Git using a shortened package identifier and a branch
Given an empty directory

When I run `wp package install schlessera/test-command:dev-custom-branch`
Then STDOUT should contain:
"""
Installing package schlessera/test-command (dev-custom-branch)
Updating {PACKAGE_PATH}composer.json to require the package...
Registering [email protected]:schlessera/test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
"""
Success: Package installed.
"""

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name | version |
| schlessera/test-command | dev-custom-branch |

When I run `wp test-command`
Then STDOUT should contain:
"""
Success: Version D.
"""

When I run `wp package uninstall schlessera/test-command`
Then STDOUT should contain:
"""
Removing require statement from {PACKAGE_PATH}composer.json
"""
And STDOUT should contain:
"""
Success: Uninstalled package.
"""

When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
schlessera/test-command
"""

Scenario: Install a package in a local zip
Expand Down

0 comments on commit 6f6e5eb

Please sign in to comment.