diff --git a/.tests/php/integration/Admin/Events/EventsTest.php b/.tests/php/integration/Admin/Events/EventsTest.php index e9833f8a..af9dce1c 100644 --- a/.tests/php/integration/Admin/Events/EventsTest.php +++ b/.tests/php/integration/Admin/Events/EventsTest.php @@ -241,6 +241,7 @@ public function test_get_forms(): void { 'source' => '[]', 'form_id' => '0', 'served' => '2', + 'id' => '1', ], ], 'total' => 1, diff --git a/.tests/php/unit/Settings/EventsPageTest.php b/.tests/php/unit/Settings/EventsPageTest.php index 71ca3802..92d77155 100644 --- a/.tests/php/unit/Settings/EventsPageTest.php +++ b/.tests/php/unit/Settings/EventsPageTest.php @@ -149,6 +149,7 @@ public function test_admin_enqueue_scripts( bool $allowed ): void { $unit = 'day'; $language_code = 'en'; $times = $allowed ? 1 : 0; + $nonce = 'some nonce'; $subject = Mockery::mock( EventsPage::class )->makePartial(); $subject->shouldAllowMockingProtectedMethods(); @@ -245,6 +246,12 @@ static function ( $name ) use ( $plugin_url, $plugin_version ) { ListPageBase::HANDLE, ListPageBase::OBJECT, [ + 'ajaxUrl' => 'admin-ajax.php', + 'bulkAction' => ListPageBase::BULK_ACTION, + 'bulkNonce' => $nonce, + 'noAction' => 'Please select a bulk action.', + 'noItems' => 'Please select at least one item to perform this action on.', + 'DoingBulk' => 'Doing bulk action...', 'delimiter' => ListPageBase::TIMESPAN_DELIMITER, 'locale' => $language_code, ] @@ -275,6 +282,8 @@ static function ( $name ) use ( $plugin_url, $plugin_version ) { ) ->times( $times ); + WP_Mock::passthruFunction( 'admin_url' ); + WP_Mock::userFunction( 'wp_create_nonce' )->andReturn( $nonce ); WP_Mock::userFunction( 'get_user_locale' )->andReturn( $language_code ); $subject->admin_enqueue_scripts(); @@ -305,6 +314,7 @@ public function test_section_callback(): void { Events ' . $datepicker . ' +

@@ -349,6 +359,7 @@ public function test_section_callback_when_not_allowed(): void { Events

+
diff --git a/.tests/php/unit/Settings/FormsPageTest.php b/.tests/php/unit/Settings/FormsPageTest.php index 253bbe93..6ade3fc9 100644 --- a/.tests/php/unit/Settings/FormsPageTest.php +++ b/.tests/php/unit/Settings/FormsPageTest.php @@ -141,6 +141,7 @@ public function test_admin_enqueue_scripts( bool $allowed ): void { $unit = 'hour'; $language_code = 'en'; $times = $allowed ? 1 : 0; + $nonce = 'some nonce'; $subject = Mockery::mock( FormsPage::class )->makePartial(); $subject->shouldAllowMockingProtectedMethods(); @@ -236,6 +237,12 @@ static function ( $name ) use ( $plugin_url, $plugin_version ) { ListPageBase::HANDLE, ListPageBase::OBJECT, [ + 'ajaxUrl' => 'admin-ajax.php', + 'bulkAction' => ListPageBase::BULK_ACTION, + 'bulkNonce' => $nonce, + 'noAction' => 'Please select a bulk action.', + 'noItems' => 'Please select at least one item to perform this action on.', + 'DoingBulk' => 'Doing bulk action...', 'delimiter' => ListPageBase::TIMESPAN_DELIMITER, 'locale' => $language_code, ] @@ -264,6 +271,8 @@ static function ( $name ) use ( $plugin_url, $plugin_version ) { ) ->times( $times ); + WP_Mock::passthruFunction( 'admin_url' ); + WP_Mock::userFunction( 'wp_create_nonce' )->andReturn( $nonce ); WP_Mock::userFunction( 'get_user_locale' )->andReturn( $language_code ); $subject->admin_enqueue_scripts(); @@ -294,6 +303,7 @@ public function test_section_callback(): void { Forms
' . $datepicker . ' +

@@ -338,6 +348,7 @@ public function test_section_callback_when_not_allowed(): void { Forms

+
diff --git a/.tests/php/unit/Settings/ListPageBaseTest.php b/.tests/php/unit/Settings/ListPageBaseTest.php index c1245d24..ba9270ea 100644 --- a/.tests/php/unit/Settings/ListPageBaseTest.php +++ b/.tests/php/unit/Settings/ListPageBaseTest.php @@ -55,12 +55,12 @@ public function test_date_picker_display(): void {