Sign inSign up

killua99/wordpress-phpunit

By killua99

•Updated almost 8 years ago

WordPress phpunit

Image
0

338

killua99/wordpress-phpunit repository overview

⁠WordPress PHP Unit Tests

Easy setup to start running test on your plugin.

Folder structure must be like

/ #Root Plugin and where your files are 
| docker-composer.json

Example of use of this docker with plugins:

version: "3"

services:
  wp_phpunit:
    image: "killua99/wordpress-phpunit:6.5.3"
    volumes:
      - ".:/app"
      - "testsuite:/tmp"
  mysql_phpunit:
    image: "mariadb:10.3.11"
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
      MYSQL_DATABASE: "wp_test"
      MYSQL_ROOT_PASSWORD: ""

volumes:
  testsuite: {}

Running test like

docker-compose -f docker-phpunit.yml run --rm wp_phpunit phpunit

A simple use with composer.json scripts

"scripts": {
        "docker-unit-up": [
            "docker-compose up -d --remove-orphans",
            "sleep 4",
            "docker-compose run --rm wp_phpunit /app/tests/bin/install.sh wp_test root '' mysql_phpunit 4.9.9 true"
        ],
        "docker-unit-down": [
            "docker-compose down --volumes"
        ],
        "docker-phpunit": [
            "docker-compose run --rm wp_phpunit phpunit"
        ],
}

and use with composer with composer docker-unit-up and keep running composer docker-phpunit when you are done composer docker-unit-down

Tag summary

Content type

Image

Digest

Size

121.9 MB

Last updated

almost 8 years ago

docker pull killua99/wordpress-phpunit