summaryrefslogtreecommitdiffstats
path: root/tests/bootstrap.php
Commit message (Collapse)AuthorAgeFilesLines
* Change how we load the plugin.Harald Eilertsen2021-09-111-1/+1
| | | | | | | | | | | | | | Since we now have code that should be available, both on the public blog and in the admin section, we need to be more graular when loading the various parts of the plugin. We still try to avoid loading admin-only parts for the public blog, but allways load the parts that we need in either case. Also avoid running the db migrations when running unit tests, as the schema is copied over from the dev environment it just caues problems. Finally, don't hardcode unit tests to always be in_admin, but rather determine that for each test.
* Fix tests.Harald Eilertsen2021-09-051-0/+1
| | | | | Since the plugin only should load on the admin side, set the WP_ADMIN constant before loading it in the tests.
* Add missing license tags to files.Harald Eilertsen2021-04-261-0/+5
|
* Fix test setup for wp-env.Harald Eilertsen2021-04-151-0/+33
After much reading I finally found the magic incantations, so now we can run tests with real database access. This means we no longer need the primitive $wpdb_stub. The setup as now _requires_ wp-env, or an environment set up sufficiently similar. Running in wp-env is the easiest, so aim for that. I've added a `run-tests` script that will invoke the magic incantation without having to remember it every time. To set up for testing: 1. make sure you have composer[1] installed. 2. run `composer install` 3. make sure you have wp-env[2] installed 4. start the wordpress env: `wp-env start` 5. run the tests: `./run-tests` Let the thousand tests bloom! [1]: https://github.com/wp-phpunit/wp-phpunit [2]: https://www.npmjs.com/package/@wordpress/env