function testItCanBeActivatedAndDeactivated() { $pid = $this->pluginId; include_once getWpRootDir() . '/wp-admin/includes/plugin.php'; if (is_plugin_active($pid)) { deactivate_plugins($pid); $this->assertFalse(is_plugin_active($pid)); activate_plugin($pid); $this->assertTrue(is_plugin_active($pid)); } else { activate_plugin($pid); deactivate_plugins($pid); $this->assertFalse(is_plugin_active($pid)); activate_plugin($pid); $this->assertTrue(is_plugin_active($pid)); } }
$testRoot = array_shift($pathParts); $testRoot = rtrim($testRoot, '/'); } return $testRoot; } /** * Override wp_mail to not send mail. * * @param $to * @param $subject * @param $message * @param string $headers * @param array $attachments * * @return bool */ function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) { return true; } $testRoot = getWpRootDir(); if (!is_dir($testRoot)) { exit(1); } require_once $testRoot . '/includes/functions.php'; function _manually_load_plugin() { require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'wprsrv.php'; } tests_add_filter('muplugins_loaded', '_manually_load_plugin'); require_once $testRoot . '/includes/bootstrap.php';
protected function getWpRoot() { return getWpRootDir(); }