1
+ <?php
2
+
3
+ use WPMVC \Addons \PHPUnit \TestCase ;
4
+ use WPMVC \Addons \Status \StatusAddon ;
5
+
6
+ /**
7
+ * Test addon class.
8
+ *
9
+ * @author 10 Quality <[email protected] >
10
+ * @package wpmvc-addon-customizer
11
+ * @license MIT
12
+ * @version 1.0.2
13
+ */
14
+ class StatusAddonTest extends TestCase
15
+ {
16
+ /**
17
+ * Tear down.
18
+ * @since 1.0.2
19
+ */
20
+ public function tearDown (): void
21
+ {
22
+ wpmvc_addon_phpunit_reset ();
23
+ }
24
+ /**
25
+ * Test init.
26
+ * @since 1.0.2
27
+ * @group addon
28
+ */
29
+ public function testInit ()
30
+ {
31
+ // Prepare
32
+ $ bridge = $ this ->getBridgeMock ();
33
+ $ addon = new StatusAddon ( $ bridge );
34
+ // Run
35
+ $ addon ->on_admin ();
36
+ // Assertc
37
+ $ this ->assertAddedAction ( 'admin_menu ' );
38
+ }
39
+ /**
40
+ * Test init.
41
+ * @since 1.0.2
42
+ * @group addon
43
+ */
44
+ public function testRenderPlugins ()
45
+ {
46
+ // Prepare
47
+ $ bridge = $ this ->getBridgeMock ();
48
+ $ addon = new StatusAddon ( $ bridge );
49
+ // Run
50
+ ob_start ();
51
+ $ addon ->render_plugins ();
52
+ $ render = ob_get_clean ();
53
+ // Assertc
54
+ $ this ->assertNotEmpty ( $ render );
55
+ $ this ->assertMatchesRegularExpression ( '/class="box-wrapper"/i ' , $ render );
56
+ $ this ->assertDidAction ( 'wpmvc_addon_status_header ' );
57
+ $ this ->assertDidAction ( 'wpmvc_addon_status_footer ' );
58
+ $ this ->assertAppliedFilters ( 'wpmvc_addon_status_tab ' );
59
+ }
60
+ /**
61
+ * Test init.
62
+ * @since 1.0.2
63
+ * @group addon
64
+ */
65
+ public function testRenderThemes ()
66
+ {
67
+ // Prepare
68
+ $ bridge = $ this ->getBridgeMock ();
69
+ $ addon = new StatusAddon ( $ bridge );
70
+ // Run
71
+ ob_start ();
72
+ $ addon ->render_themes ();
73
+ $ render = ob_get_clean ();
74
+ // Assertc
75
+ $ this ->assertNotEmpty ( $ render );
76
+ $ this ->assertMatchesRegularExpression ( '/class="box-wrapper"/i ' , $ render );
77
+ $ this ->assertDidAction ( 'wpmvc_addon_status_header ' );
78
+ $ this ->assertDidAction ( 'wpmvc_addon_status_footer ' );
79
+ $ this ->assertAppliedFilters ( 'wpmvc_addon_status_tab ' );
80
+ }
81
+ /**
82
+ * Test init.
83
+ * @since 1.0.2
84
+ * @group addon
85
+ */
86
+ public function testRenderCache ()
87
+ {
88
+ // Prepare
89
+ $ bridge = $ this ->getBridgeMock ();
90
+ $ addon = new StatusAddon ( $ bridge );
91
+ $ _GET ['tab ' ] = 'cache ' ;
92
+ // Run
93
+ ob_start ();
94
+ $ addon ->render_plugins ();
95
+ $ render = ob_get_clean ();
96
+ // Assertc
97
+ $ this ->assertNotEmpty ( $ render );
98
+ $ this ->assertMatchesRegularExpression ( '/class="box-wrapper"/i ' , $ render );
99
+ $ this ->assertMatchesRegularExpression ( '/Flush/i ' , $ render );
100
+ $ this ->assertDidAction ( 'wpmvc_addon_status_header ' );
101
+ $ this ->assertDidAction ( 'wpmvc_addon_status_footer ' );
102
+ }
103
+ }
0 commit comments