-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathclass-test-case.php
More file actions
68 lines (59 loc) · 1.44 KB
/
class-test-case.php
File metadata and controls
68 lines (59 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* Test Case for the Plugin's Unit Tests.
*
* @package KnowTheCode\GitContributing\Tests\PHP\Unit
* @since 1.0.0
* @link https://github.com/KnowTheCode/git-contributing
* @license GNU-2.0+
*/
namespace KnowTheCode\GitContributing\Tests\PHP\Unit;
use Brain\Monkey;
use KnowTheCode\GitContributing\Tests\PHP\Test_Case_Trait;
use PHPUnit\Framework\TestCase;
/**
* Abstract Class Test_Case
*
* @package KnowTheCode\GitContributing\Tests\PHP\Unit
*/
abstract class Test_Case extends TestCase {
use Test_Case_Trait;
/**
* Prepares the test environment before each test.
*/
public function setUp() {
$this->test_root_dir = get_test_root_dir() . DIRECTORY_SEPARATOR;
parent::setUp();
Monkey\setUp();
}
/**
* Cleans up the test environment after each test.
*/
protected function tearDown() {
Monkey\tearDown();
parent::tearDown();
}
/**
* Setup the stubs for the common WordPress escaping and internationalization functions.
*/
protected function setup_common_wp_stubs() {
// Common escaping functions.
Monkey\Functions\stubs( array(
'esc_attr',
'esc_html',
'esc_textarea',
'esc_url',
'wp_kses_post',
) );
// Common internationalization functions.
Monkey\Functions\stubs( array(
'__',
'esc_html__',
'esc_html_x',
'esc_attr_x',
) );
foreach ( array( 'esc_attr_e', 'esc_html_e', '_e' ) as $wp_function ) {
Monkey\Functions\when( $wp_function )->echoArg();
}
}
}