2017 © Pedro Peláez
 

library wordpress-extension

WordPress extension for Behat 3

image

tmf/wordpress-extension

WordPress extension for Behat 3

  • Thursday, February 4, 2016
  • by tmf
  • Repository
  • 2 Watchers
  • 10 Stars
  • 6,361 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 22 Forks
  • 1 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

WordPress Extension for Behat 3

This is a Behat 3.0 Extension for WordPress plugin and theme development. You can use it to test your WordPress installation, or just test your plugin/theme without installing them in a normal WordPress installation (i.e. stand-alone). The Extension allows you to use WordPress functions in your context class (if you extend it from Tmf\WordPressExtension\Context\WordPressContext)., (*1)

Installation

  1. Add a composer development requirement for your WordPress theme or plugin:, (*2)

    {
        "require-dev" : {
            "tmf/wordpress-extension": "~0.1",
            "johnpbloch/wordpress": "~4.0.0"
        }
    }
    
  2. Add the following Behat configuration file:, (*3)

    default:
      suites:
        default:
          contexts:
            - Tmf\WordPressExtension\Context\WordPressContext
      extensions:
        Tmf\WordPressExtension:
          path: '%paths.base/vendor/wordpress'
    
        Behat\MinkExtension:
          base_url:    'http://localhost:8000'
          sessions:
            default:
              goutte: ~
    
    
  3. Install the vendors and initialize behat test suites, (*4)

    composer update
    vendor/bin/behat --init
    
  4. Start your development web server and point its document root to the wordpress directory in vendors (without mail function), (*5)

    php -S localhost:8000 -t vendor/wordpress -d disable_functions=mail
    
  5. Write some Behat features and test them, (*6)

    Feature: Manage plugins
        In order to manage plugins
        As an admin
        I need to enable and disable plugins
    
        Background:
            Given I have a vanilla wordpress installation
                | name          | email                   | username | password |
                | BDD WordPress | your@email.com          | admin    | test     |
            And I am logged in as "admin" with password "test"
    
        Scenario: Enable the dolly plugin
            Given there are plugins
                | plugin    | status  |
                | hello.php | enabled |
            When I go to "/wp-admin/"
            Then I should see a "#dolly" element
    
        Scenario: Disable the dolly plugin
            Given there are plugins
                | plugin    | status   |
                | hello.php | disabled |
            When I go to "/wp-admin/"
            Then I should not see a "#dolly" element
    
    
  6. Run the tests, (*7)

    vendor/bin/behat
    

The Versions

04/02 2016

dev-master

9999999-dev

WordPress extension for Behat 3

  Sources   Download

MIT

The Requires

 

wordpress bdd behat story

21/11 2015
16/11 2014
02/11 2014

dev-behat3

dev-behat3

WordPress extension for Behat 3

  Sources   Download

MIT

The Requires

 

wordpress bdd behat story

22/03 2014

0.0.4

0.0.4.0

WordPress extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress bdd behat story

22/03 2014

dev-develop

dev-develop

WordPress extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress bdd behat story

17/03 2014

0.0.3

0.0.3.0

WordPress extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress bdd behat story

17/03 2014

0.0.2

0.0.2.0

WordPress extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

16/03 2014

0.0.1

0.0.1.0

WordPress extension for Behat

  Sources   Download

MIT

The Requires

 

The Development Requires