-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup unit tests seperate from WordPress 'unit' tests #2701
- Loading branch information
Josh Pollock
committed
Oct 18, 2018
1 parent
4e5ca18
commit 4f5a904
Showing
452 changed files
with
44,139 additions
and
7 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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
<phpunit | ||
bootstrap="tests/bootstrap-unit.php" | ||
backupGlobals="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
> | ||
<testsuites> | ||
<testsuite name="unit" suffix=".php"> | ||
<directory>./tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
<log type="coverage-clover" target="clover.xml"/> | ||
</phpunit> |
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 calderawp\calderaforms\Tests\Unit; | ||
|
||
|
||
class SampleTest extends TestCase | ||
{ | ||
|
||
/** | ||
* Super basic test for educational purposes | ||
* | ||
* @covers TestCase | ||
*/ | ||
public function testTheTruth() | ||
{ | ||
//What should the value be? | ||
$excepted = true; | ||
//What is the value actually | ||
$actual = false; | ||
//Are they not the same? | ||
$this->assertNotEquals($excepted, $actual); | ||
} | ||
|
||
} |
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,56 @@ | ||
<?php | ||
|
||
|
||
namespace calderawp\calderaforms\Tests\Unit; | ||
|
||
|
||
use Brain\Monkey; | ||
|
||
use calderawp\calderaforms\Tests\Util\Traits\SharedFactories; | ||
use PHPUnit\Framework\TestCase as FrameworkTestCase; | ||
|
||
/** | ||
* Class TestCase | ||
* | ||
* Default test case for all unit tests | ||
* @package CalderaLearn\RestSearch\Tests\Unit | ||
*/ | ||
abstract class TestCase extends FrameworkTestCase | ||
{ | ||
use SharedFactories; | ||
/** | ||
* Prepares the test environment before each test. | ||
*/ | ||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
Monkey\setUp(); | ||
|
||
$this->setup_common_wp_stubs(); | ||
} | ||
|
||
/** | ||
* Cleans up the test environment after each test. | ||
*/ | ||
protected function tearDown() | ||
{ | ||
Monkey\tearDown(); | ||
parent::tearDown(); | ||
} | ||
|
||
//phpcs:disable | ||
/** | ||
* Set up the stubs for the common WordPress escaping and internationalization functions. | ||
*/ | ||
protected function setup_common_wp_stubs() | ||
{ | ||
// Common internationalization functions. | ||
Monkey\Functions\stubs(array( | ||
'__', | ||
'esc_html__', | ||
'esc_html_x', | ||
'esc_attr_x', | ||
)); | ||
} | ||
//phpcs:enable | ||
} |
Oops, something went wrong.