-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtest-class-plugin.php
More file actions
53 lines (33 loc) · 923 Bytes
/
test-class-plugin.php
File metadata and controls
53 lines (33 loc) · 923 Bytes
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
<?php
namespace WPCW;
final class TestPlugin extends TestCase {
function setUp() {
parent::setUp();
$this->plugin = new Plugin();
}
/**
* Test that all required actions and filters are added as expected
*/
function test_init() {
Plugin::init();
$this->do_action_validation( 'widgets_init', [ __NAMESPACE__ . '\Plugin', 'register_widgets' ] );
}
/**
* Test for register_widget function
*/
function test_register_widget() {
global $wp_widget_factory;
// Check contact widget presence.
$this->assertTrue(
class_exists( 'WPCW\Contact' ),
'Class WPCW\Contact is not found'
);
$this->assertTrue( isset( $wp_widget_factory->widgets['WPCW\Contact'] ) );
// Check social widget class presence.
$this->assertTrue(
class_exists( 'WPCW\Social' ),
'Class WPCW\Social is not found'
);
$this->assertTrue( isset( $wp_widget_factory->widgets['WPCW\Social'] ) );
}
}