, (*1)
, (*2)
wp-nonce testing
Using WordPressDev Composer Fork, (*3)
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., (*4)
SETUP
To install this package we are using composer., (*5)
Composer
Once you have installed composer following the procedure available here, you can, (*6)
- 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, (*7)
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 named wp_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