{"id":18785413,"url":"https://github.com/swashata/wptest-docker","last_synced_at":"2025-08-27T01:48:49.534Z","repository":{"id":73831022,"uuid":"97358800","full_name":"swashata/wptest-docker","owner":"swashata","description":"Docker Container for testing WordPress Plugins and Themes","archived":false,"fork":false,"pushed_at":"2017-09-05T07:50:59.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T12:37:03.570Z","etag":null,"topics":["docker-container","wordpress-tests"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/wpquark/wptest-php-nodejs-grunt/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swashata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-16T04:01:47.000Z","updated_at":"2020-04-19T14:53:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"76325337-17aa-4c89-83ad-01310408f731","html_url":"https://github.com/swashata/wptest-docker","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swashata%2Fwptest-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swashata%2Fwptest-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swashata%2Fwptest-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swashata%2Fwptest-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swashata","download_url":"https://codeload.github.com/swashata/wptest-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239701456,"owners_count":19682916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-container","wordpress-tests"],"created_at":"2024-11-07T20:46:42.419Z","updated_at":"2025-02-19T17:25:11.867Z","avatar_url":"https://github.com/swashata.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Container for Automated WordPress Testing and Build\n\nSo in my workflow I use the following:\n\n* [WP-CLI](http://wp-cli.org/) to manage WordPress from commandline.\n* [PHPUnitTest](https://phpunit.de/) for testing WordPress themes and plugin.\n* [Nodejs](https://nodejs.org/en/) for javascript related stuff.\n* [Grunt](https://gruntjs.com/) for automating builds and release.\n\nFor this to work under [gitlab](https://about.gitlab.com/) and [gitlab-ci](https://about.gitlab.com/features/gitlab-ci-cd/) I need a docker which would essentially have the following:\n\n* **PHP-7.0 with CLI** - for unittesting.\n* **Nodejs** - for using npm and grunt.\n* **[WordPress Test](https://make.wordpress.org/cli/handbook/plugin-unit-tests/)** - an environment for making WordPress Plugin/Theme unit testing a breeze.\n\nIn this attempt, I am creating a docker which would have the following installed by default, so that I don't have to everytime.\n\n## Docker Container Features\n\n* `PHP-7.0`\n* `Nodejs` and `npm`\n* `Grunt-CLI` installed globally.\n* `Bower` installed globally.\n* `Git`\n* `vim wget zip unzip subversion mysql-client libmcrypt-dev libmysqlclient-dev zip unzip openssh-client gettext`\n* `PHPUnit` - PHAR Install.\n* `Composer` - PHAR Install.\n* `WP-CLI` setup for WordPress unit testing: ( `/usr/local/bin/wp` )\n\t* Downloaded WordPress latest.zip with proper environment setup. - `WP_CORE_DIR`\n\t* SVN-ed WordPress test libraries with proper environment setup. - `WP_TESTS_DIR`\n\nFor `WP_UnitTest` the following environment variables are set:\n\n* `WP_CORE_DIR` \"/tmp/wordpress/\"\n* `WP_TESTS_DIR` \"/tmp/wordpress-tests-lib\"\n* `WP_VERSION` \"4.8\"\n* `WP_TESTS_TAG` \"tags/4.8\"\n\nSo if you have used `WP-CLI` to scaffold your `PHP_UnitTest` (which you should), you are covered. The install will run to only setup the databse variables and the test-config file.\n\n## Sample `.gitlab-ci.yml` configuration\n\n```yaml\n# Our base image\nimage: wpquark/wptest-php-nodejs-grunt:latest\n\n# mysql service\nservices:\n- mysql\n\n# Select what we should cache\ncache:\n  paths:\n  - vendor/\n  - node_modules/\n\nbefore_script:\n# Install npm dependencies\n- npm install\n\n# Install composer\n- composer install\n\n# Install WordPress PHPUnit Test\n- bash bin/install-wp-tests.sh wordpress_test root mysql mysql $WP_VERSION\n\nvariables:\n  # Configure mysql service (https://hub.docker.com/_/mysql/)\n  MYSQL_DATABASE: wordpress_tests\n  MYSQL_ROOT_PASSWORD: mysql\n  WP_MULTISITE: \"0\"\n\n# We test on php7\n# default job\ndefault-job:\n  tags:\n    - wordpress\n  script:\n  - grunt\n  except:\n    - tags\n\n# release job on tag\nrelease-job:\n  tags:\n    - wordpress\n  script:\n    - grunt release\n  artifacts:\n    paths:\n      - build/wpq-social-press.zip\n  only:\n   - tags\n```\n\nThe above is just a sample. In real world, we use multiple stages with `test \u003e build \u003e deploy (staging \u003e production)` strategy. Check gitlab documentation for information on that.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswashata%2Fwptest-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswashata%2Fwptest-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswashata%2Fwptest-docker/lists"}