-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192 from plausible/automated_testing
Automated testing
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Unit tests | ||
/tmp | ||
/tests/bin/tmp | ||
.phpunit.cache | ||
|
||
# Numerous always-ignore extensions | ||
.diff | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Plausible\Analytics\Tests; | ||
|
||
use Yoast\WPTestUtils\BrainMonkey\TestCase as YoastTestCase; | ||
|
||
class TestCase extends YoastTestCase { | ||
public function __construct() { | ||
/** | ||
* During local unit testing this constant is required. | ||
*/ | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
define( 'ABSPATH', true ); | ||
} | ||
|
||
/** | ||
* Required for loading assets. | ||
*/ | ||
if ( ! defined( 'PLAUSIBLE_TESTS_ROOT' ) ) { | ||
define( 'PLAUSIBLE_TESTS_ROOT', __DIR__ . '/' ); | ||
} | ||
|
||
parent::__construct(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* @package Plausible Analytics Integration Tests - Plugin | ||
*/ | ||
|
||
namespace Plausible\Analytics\Tests\Integration; | ||
|
||
use Plausible\Analytics\Tests\TestCase; | ||
use Plausible\Analytics\WP\Plugin; | ||
|
||
class PluginTest extends TestCase { | ||
/** | ||
* | ||
*/ | ||
public function testRegister() { | ||
$class = new Plugin(); | ||
$class->register(); | ||
|
||
do_action( 'plugins_loaded' ); | ||
|
||
$this->assertTrue( class_exists( '\Plausible\Analytics\WP\Setup' ) ); | ||
|
||
define( 'WP_ADMIN', true ); | ||
|
||
$class->register(); | ||
|
||
do_action( 'plugins_loaded' ); | ||
|
||
$this->assertTrue( class_exists( '\Plausible\Analytics\WP\Admin\SelfHosted' ) ); | ||
} | ||
} |