wp-cli / scaffold-package-command

Scaffolds WP-CLI commands with functional tests, full README.md, and more.
MIT License
68 stars 19 forks source link

Add context to behat which can check the contents with regexp #148

Closed miya0001 closed 6 years ago

miya0001 commented 6 years ago

I added the new context to behat which can check the file contents with regex like following.

When I run `echo "hello" > hello.txt`
Then the hello.txt file should match /^H.+o$/i

Related: https://github.com/wp-cli/scaffold-command/pull/61#discussion_r143706183

danielbachhuber commented 6 years ago

@miya0001 Although it's not obvious, the source of truth (e.g. original copy) for the test suite is wp-cli/wp-cli. Can you submit these same changes to that repo too?

miya0001 commented 6 years ago

@danielbachhuber

Fixed it and I added same context for STDOUT/STDERR.

Example:

Feature: Regex context

  Scenario: Regex!
    Given an empty directory

    When I run `echo "hello" > hello.txt`
    Then the contents of the hello.txt file should match /H.+o/i

    When I run `echo "hello"`
    Then STDOUT should match /H.+o/i