Skip to content

Commit 66c35ae

Browse files
author
Josh Kadis
committed
ready for unit tests
1 parent a0effc1 commit 66c35ae

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Diff for: phpunit.xml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<phpunit
2+
bootstrap="tests/bootstrap.php"
3+
backupGlobals="false"
4+
colors="true"
5+
convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
>
9+
<testsuites>
10+
<testsuite>
11+
<directory prefix="test-" suffix=".php">./tests/</directory>
12+
</testsuite>
13+
</testsuites>
14+
<filter>
15+
<whitelist processUncoveredFilesFromWhitelist="true">
16+
<directory suffix=".php">./</directory>
17+
<exclude>
18+
<directory suffix=".php">./tests/</directory>
19+
<directory suffix=".php">./bin/</directory>
20+
<file>./inc/cli.php</file>
21+
</exclude>
22+
</whitelist>
23+
</filter>
24+
</phpunit>

Diff for: tests/bootstrap.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
$_tests_dir = getenv( 'WP_TESTS_DIR' );
3+
4+
if ( ! $_tests_dir ) {
5+
$_tests_dir = '/tmp/wordpress-tests-lib';
6+
}
7+
8+
require_once $_tests_dir . '/includes/functions.php';
9+
10+
function _manually_load_plugin() {
11+
if ( ! defined( 'HH_HUGO_UNIT_TESTS_RUNNING' ) ) {
12+
define( 'HH_HUGO_UNIT_TESTS_RUNNING', true );
13+
}
14+
require dirname( dirname( __FILE__ ) ) . '/command.php';
15+
}
16+
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
17+
18+
require $_tests_dir . '/includes/bootstrap.php';

0 commit comments

Comments
 (0)