Passed
Branch ci (072b24)
by litefeel
05:02
created

_manually_load_plugin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * PHPUnit bootstrap file
4
 */
5
$_tests_dir = getenv( 'WP_TESTS_DIR' );
6
if ( ! $_tests_dir ) {
7
    $_tests_dir = '/tmp/wordpress-tests-lib';
8
}
9
// Give access to tests_add_filter() function.
10
require_once $_tests_dir . '/includes/functions.php';
0 ignored issues
show
Bug introduced by
Are you sure $_tests_dir of type string|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

10
require_once /** @scrutinizer ignore-type */ $_tests_dir . '/includes/functions.php';
Loading history...
11
12
define( 'WRITING_ON_GITHUB_TEST', true );
13
14
/**
15
 * Manually load the plugin being tested.
16
 */
17
function _manually_load_plugin() {
18
    require dirname( __FILE__ ) . '/../../writing-on-github.php';
19
    remove_action( 'plugins_loaded', array( Writing_On_GitHub::$instance, 'boot' ) );
20
}
21
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
0 ignored issues
show
Bug introduced by
The function tests_add_filter was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
/** @scrutinizer ignore-call */ 
22
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
Loading history...
22
// Start up the WP testing environment.
23
require $_tests_dir . '/includes/bootstrap.php';
24
25
error_reporting( E_ALL ^ E_DEPRECATED );
26