Skip to content

Commit 09ed3cc

Browse files
committed
chore: code style
1 parent 7bdf7d7 commit 09ed3cc

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

tests/test-ajax.php

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,22 @@
88
* @since 3.10.12
99
*/
1010

11+
/**
12+
* Test the AJAX functionality.
13+
*/
1114
class Test_Visualizer_Ajax extends WP_Ajax_UnitTestCase {
1215

16+
/**
17+
* Admin user ID.
18+
*
19+
* @var int
20+
*/
1321
private $admin_user_id;
1422

15-
public function setUp() :void {
23+
/**
24+
* Set up.
25+
*/
26+
public function setUp() {
1627
parent::setUp();
1728
$this->admin_user_id = $this->factory->user->create(
1829
array(
@@ -23,6 +34,9 @@ public function setUp() :void {
2334

2435
}
2536

37+
/**
38+
* Test the AJAX response for fetching the database data.
39+
*/
2640
public function test_ajax_response_get_query_data_valid_query() {
2741
$this->_setRole( 'administrator' );
2842

@@ -34,7 +48,7 @@ public function test_ajax_response_get_query_data_valid_query() {
3448
try {
3549
// Trigger the AJAX action
3650
$this->_handleAjax( Visualizer_Plugin::ACTION_FETCH_DB_DATA );
37-
} catch (WPAjaxDieContinueException $e) {
51+
} catch ( WPAjaxDieContinueException $e ) {
3852
// We expected this, do nothing.
3953
}
4054

@@ -45,6 +59,9 @@ public function test_ajax_response_get_query_data_valid_query() {
4559
$this->assertTrue( $response->success );
4660
}
4761

62+
/**
63+
* Test the AJAX response for fetching the database data with invalid query.
64+
*/
4865
public function test_ajax_response_get_query_data_invalid_query() {
4966
$this->_setRole( 'administrator' );
5067

@@ -56,7 +73,7 @@ public function test_ajax_response_get_query_data_invalid_query() {
5673
try {
5774
// Trigger the AJAX action
5875
$this->_handleAjax( Visualizer_Plugin::ACTION_FETCH_DB_DATA );
59-
} catch (WPAjaxDieContinueException $e) {
76+
} catch ( WPAjaxDieContinueException $e ) {
6077
// We expected this, do nothing.
6178
}
6279

@@ -68,6 +85,9 @@ public function test_ajax_response_get_query_data_invalid_query() {
6885
$this->assertFalse( $response->success );
6986
}
7087

88+
/**
89+
* Test the AJAX response for fetching the database data with user capability.
90+
*/
7191
public function test_ajax_response_get_query_data_subcriber_dissallow() {
7292
$this->_setRole( 'subscriber' );
7393

@@ -79,7 +99,7 @@ public function test_ajax_response_get_query_data_subcriber_dissallow() {
7999
try {
80100
// Trigger the AJAX action
81101
$this->_handleAjax( Visualizer_Plugin::ACTION_FETCH_DB_DATA );
82-
} catch (WPAjaxDieContinueException $e) {
102+
} catch ( WPAjaxDieContinueException $e ) {
83103
// We expected this, do nothing.
84104
}
85105

0 commit comments

Comments
 (0)