Failed Conditions
Push — develop ( 8742c8...2359ff )
by Remco
04:03
created

_manually_load_plugin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 25 and the first side effect is on line 11.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Bootstrap tests
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2019 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Money
9
 */
10
11
putenv( 'WP_PHPUNIT__TESTS_CONFIG=tests/wp-config.php' );
12
13
require_once __DIR__ . '/../vendor/autoload.php';
14
15
if ( is_readable( '.env' ) ) {
16
	$dotenv = new Dotenv\Dotenv( __DIR__ );
17
	$dotenv->load();
18
}
19
20
require_once getenv( 'WP_PHPUNIT__DIR' ) . '/includes/functions.php';
21
22
/**
23
 * Manually load plugin.
24
 */
25
function _manually_load_plugin() {
26
	require __DIR__ . '/../pronamic-money.php';
27
}
28
29
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
0 ignored issues
show
Bug introduced by
'_manually_load_plugin' of type string is incompatible with the type array|object expected by parameter $function_to_add of tests_add_filter(). ( Ignorable by Annotation )

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

29
tests_add_filter( 'muplugins_loaded', /** @scrutinizer ignore-type */ '_manually_load_plugin' );
Loading history...
30
31
// Bootstrap.
32
require getenv( 'WP_PHPUNIT__DIR' ) . '/includes/bootstrap.php';
33