Skip to content
This repository has been archived by the owner on Aug 27, 2018. It is now read-only.

Commit

Permalink
Add basic PHPUnit unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-c committed Jan 12, 2016
1 parent 32e1f89 commit 32d6d49
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
14 changes: 14 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<testsuites>
<testsuite>
<directory prefix="test-" suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
15 changes: 15 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

$_tests_dir = getenv( 'WP_TESTS_DIR' );
if ( ! $_tests_dir ) {
$_tests_dir = '/tmp/wordpress-tests-lib';
}

require_once $_tests_dir . '/includes/functions.php';

function _manually_load_plugin() {
require dirname( dirname( __FILE__ ) ) . '/wp-web-push/wp-web-push.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

require $_tests_dir . '/includes/bootstrap.php';
9 changes: 9 additions & 0 deletions tests/test-sample.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

class SampleTest extends WP_UnitTestCase {
function test_sample() {
$this->assertTrue(true);
}
}

?>

0 comments on commit 32d6d49

Please sign in to comment.