Skip to content

Commit

Permalink
Update PHPUnit tests to use WPPPB
Browse files Browse the repository at this point in the history
Uses Composer's autoloading to load HTTP testcase now too.
  • Loading branch information
JDGrimes committed Dec 5, 2016
1 parent a525d5d commit f1f983c
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 72 deletions.
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ before_script:

script:
- codesniff-php-syntax
- codesniff-php-autoloaders
- codesniff-phpcs
- codesniff-strings
- codesniff-jshint
- codesniff-l10n
- codesniff-xmllint
Expand All @@ -70,6 +72,7 @@ script:
- phpunit-ajax
- phpunit-ms-ajax
- phpunit-ms-network-ajax
- wpcept-run

after_script:
- source $DEV_LIB_PATH/travis/after_script.sh
16 changes: 14 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
"php": ">=5.2.0"
},
"require-dev": {
"wordpoints/module-uninstall-tester": "^0.4.0",
"jdgrimes/wp-http-testcase": "~1.2"
"jdgrimes/wp-http-testcase": "^1.2.3",
"jdgrimes/wpppb": "^0.2.2",
"xrstf/composer-php52": "^1.0"
},
"scripts": {
"post-install-cmd": [
"xrstf\\Composer52\\Generator::onPostInstallCmd"
],
"post-update-cmd": [
"xrstf\\Composer52\\Generator::onPostInstallCmd"
],
"post-autoload-dump": [
"xrstf\\Composer52\\Generator::onPostInstallCmd"
]
}
}
84 changes: 46 additions & 38 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev-lib
5 changes: 0 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,4 @@
<directory suffix=".php">tests/phpunit/tests/</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>uninstall</group>
</exclude>
</groups>
</phpunit>
10 changes: 3 additions & 7 deletions tests/phpunit/includes/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@
* @since 1.0.0
*/

/**
* The WP HTTP testcase bootstrap.
*
* @since 1.1.0
*/
require_once WORDPOINTSORG_TESTS_DIR . '/../../vendor/jdgrimes/wp-http-testcase/wp-http-testcase.php';
if ( ! WordPoints_PHPUnit_Bootstrap_Loader::instance()->running_uninstall_tests() ) {

if ( ! running_wordpoints_module_uninstall_tests() ) {
WP_HTTP_TestCase::init();

add_filter( 'wordpoints_modules_dir', 'wordpointsorgtests_modules_dir', 20 );
}

/**
Expand Down
9 changes: 0 additions & 9 deletions tests/phpunit/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
*/
define( 'WORDPOINTSORG_TESTS_DIR', dirname( dirname( __FILE__ ) ) );

/**
* @since 1.1.0
*/
define( 'WORDPOINTS_TESTS_LOAD_MODULE_ADMIN', WORDPOINTSORG_TESTS_DIR . '/../../src/admin/admin.php' );

/**
* @since 1.1.0
*/
Expand Down Expand Up @@ -54,8 +49,4 @@ function wordpointsorgtests_modules_dir() {
return WORDPOINTSORG_TESTS_DIR . '/data/modules/';
}

if ( ! running_wordpoints_module_uninstall_tests() ) {
tests_add_filter( 'wordpoints_modules_dir', 'wordpointsorgtests_modules_dir', 20 );
}

// EOF
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@
* Test that the module installs and uninstalls itself properly.
*
* @since 1.0.0
*
* @group uninstall
*/
class WordPointsOrg_Uninstall_Test extends WordPoints_Module_Uninstall_UnitTestCase {

/**
* @since 1.1.3
*/
protected $module_file = 'wordpointsorg/wordpointsorg.php';
class WordPointsOrg_Uninstall_Test extends WordPoints_Dev_Lib_PHPUnit_TestCase_Module_Uninstall {

/**
* Test that install and uninstall work as expected.
Expand Down

0 comments on commit f1f983c

Please sign in to comment.