Skip to content

Commit

Permalink
Merge pull request #39 from s-hinse/fix_unittest_#37
Browse files Browse the repository at this point in the history
Fix unittest #37
  • Loading branch information
s-hinse committed Feb 2, 2016
2 parents 44dc204 + 6763aaf commit e90230b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 30 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: php
php:
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- hhvm
- nightly
5 changes: 1 addition & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
>
<testsuites>
<testsuite name="unit tests">
<directory suffix="Test.php">./test/UnitTests</directory>
</testsuite>
<testsuite name="integration tests">
<directory suffix="Test.php">./test/IntegrationTests</directory>
</testsuite>
</testsuites>
</phpunit>
6 changes: 3 additions & 3 deletions src/inc/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ public function register_plugin_pages() {
$cap = apply_filters( 'insr-capability', 'install_plugins' );

add_submenu_page( 'tools.php', __( 'Backup Database', 'insr' ),
__( 'Backup Database', 'insr' ), $cap, 'db_backup',
__( 'Search & Replace', 'insr' ), $cap, 'db_backup',
array( $this, 'show_db_backup_page' ) );

add_submenu_page( 'tools.php', __( 'Replace Domain URL', 'insr' ),
__( 'Replace Domain URL', 'insr' ), $cap, 'replace_domain',
array( $this, 'show_replace_domain_page' ) );

add_submenu_page( 'tools.php', __( 'Search & Replace', 'insr' ),
__( 'Search & Replace', 'insr' ), $cap, 'inpsyde_search_replace',
__( 'Search & Replace Page', 'insr' ), $cap, 'inpsyde_search_replace',
array( $this, 'show_search_replace_page' ) );

add_submenu_page( 'tools.php', __( 'SQL Import', 'insr' ),
Expand All @@ -113,7 +113,7 @@ public function register_plugin_pages() {
*/
public function remove_submenu_pages() {

remove_submenu_page( 'tools.php', 'db_backup' );
remove_submenu_page( 'tools.php', 'inpsyde_search_replace' );
remove_submenu_page( 'tools.php', 'sql_import' );
remove_submenu_page( 'tools.php', 'replace_domain' );
remove_submenu_page( 'tools.php', 'credits' );
Expand Down
29 changes: 6 additions & 23 deletions test/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php # -*- coding: utf-8 -*-
namespace Inpsyde\SearchReplace;

$base_dir = dirname( __DIR__ );

Expand All @@ -7,30 +8,12 @@
if ( file_exists( $composer_file ) )
require_once $composer_file;

require_once $base_dir . './inc/Autoloader.php';
require_once $base_dir . './inc/Replace.php';
require_once $base_dir . './inc/DatabaseExporter.php';
require_once $base_dir. './inc/DatabaseManager.php';
require_once $base_dir. './inc/Admin.php';
require_once $base_dir . './inc/DatabaseImporter.php';
$src_dir =$base_dir.'/src/';

//set up autoloader

// set up integration tests with wp-tests testsuite
require_once $src_dir . 'inc/Autoloader.php';
$autoloader = new inc\Autoloader( __NAMESPACE__, $src_dir );
$autoloader->register();



//set path to your wp-tests directory here
$tests_dir = 'D:\web\wp-tests\wordpress-dev\tests\phpunit';
define( 'WP_TESTS_DIR',$tests_dir);
define ('TEST_PLUGIN_FILE',$base_dir . './inspyde-search-replace.php');
echo TEST_PLUGIN_FILE;

require_once $tests_dir . '/includes/functions.php';
function _manually_load_plugin() {
require TEST_PLUGIN_FILE;
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
require $tests_dir . '/includes/bootstrap.php';

activate_plugin('search-and-replace','inpsyde-search-replace.php');
echo "search & replace plugin activated \n";

0 comments on commit e90230b

Please sign in to comment.