vagrantin / wp-nonce
Playing and testing Wordpress nonces with phpunit tests
dev-master
2017-05-19 06:03 UTC
This package is not auto-updated.
Last update: 2025-06-08 06:13:59 UTC
README
wp-nonce testing
Using WordPressDev Composer Fork
The purpose of this project is to test and validate Wordpress WP-nonces using phpunit test.
For this purpose I took the party to use WordPress Dev environement to perform those tests.
SETUP
To install this package we are using composer.
Composer
Once you have installed composer following the procedure available here, you can
- Grab the composer.json from my git repository wp-nonce-package, with your prefered methode.
- Or create a composer.json file in a new project directory and write down manualy those informations:
{
"minimum-stability": "dev",
"require-dev": {
"vagrantin/wp-nonce": "^1.0"
},
"require": {
}
}
- Now you can run
composer update
this will trigger the install of the package. - Then you have to go to the
vendor/vagrantin/wp-nonce/
directory to perform all the following steps.
From here we consider that you are in the vendor/vagrantin/wp-nonce/
directory for all the next steps
PHPUnit Test
- The PHPUnit test files are in the Test/ folder, named
nonceTest.php
WP-NONCE
- The wp-nonce demo file is in the
src/wp-content/plugins/
folder namedwp_nonce_demo.php
Wordpress
- Because those tests are based on Wordpress Dev environement, we have to setup a mysql database, it has to be a new database has those tests are destructive.
- Setup and create a test Database in mysql.
- Use wp-tests-config-sample.php to create a wp-tests-config.php file, so Wordpress Dev can access this newly created database.
Run the Tests
- run
phpunit