diff --git a/src/Modules/Login.php b/src/Modules/Login.php index e1e9f16f..34af4ce8 100644 --- a/src/Modules/Login.php +++ b/src/Modules/Login.php @@ -83,16 +83,16 @@ public function init(): void { * Actions. */ add_action( 'login_form', [ $this, 'login_button' ] ); - // Priority is 20 because of issue: https://core.trac.wordpress.org/ticket/46748. - add_action( 'authenticate', [ $this, 'authenticate' ], 20 ); - add_action( 'rtcamp.google_register_user', [ $this->authenticator, 'register' ] ); add_action( 'rtcamp.google_user_created', [ $this, 'user_meta' ] ); add_action( 'wp_login', [ $this, 'login_redirect' ] ); /** * Filters. */ + // Priority is 20 because of issue: https://core.trac.wordpress.org/ticket/46748. + add_filter( 'authenticate', [ $this, 'authenticate' ], 20 ); add_filter( 'rtcamp.google_redirect_url', [ $this, 'redirect_url' ] ); + add_filter( 'rtcamp.google_register_user', [ $this->authenticator, 'register' ] ); add_filter( 'rtcamp.google_login_state', [ $this, 'state_redirect' ] ); } diff --git a/src/Plugin.php b/src/Plugin.php index 72b65b74..c2451b20 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -111,7 +111,7 @@ public function run(): void { add_action( 'init', [ $this, 'load_translations' ] ); - add_action( 'plugin_action_links_' . plugin_basename( $this->path ) . '/login-with-google.php', [ $this, 'add_plugin_action_links' ] ); + add_filter( 'plugin_action_links_' . plugin_basename( $this->path ) . '/login-with-google.php', [ $this, 'add_plugin_action_links' ] ); } /** diff --git a/tests/php/Unit/Modules/LoginTest.php b/tests/php/Unit/Modules/LoginTest.php index b1b900b9..5f7cdc07 100644 --- a/tests/php/Unit/Modules/LoginTest.php +++ b/tests/php/Unit/Modules/LoginTest.php @@ -74,12 +74,12 @@ public function testImplementsModuleInterface() { */ public function testInit() { WP_Mock::expectActionAdded( 'login_form', [ $this->testee, 'login_button' ] ); - WP_Mock::expectActionAdded( 'authenticate', [ $this->testee, 'authenticate' ], 20 ); - WP_Mock::expectActionAdded( 'rtcamp.google_register_user', [ $this->authenticatorMock, 'register' ] ); - WP_Mock::expectActionAdded( 'rtcamp.google_redirect_url', [ $this->testee, 'redirect_url' ] ); WP_Mock::expectActionAdded( 'rtcamp.google_user_created', [ $this->testee, 'user_meta' ] ); - WP_Mock::expectFilterAdded( 'rtcamp.google_login_state', [ $this->testee, 'state_redirect' ] ); WP_Mock::expectActionAdded( 'wp_login', [ $this->testee, 'login_redirect' ] ); + WP_Mock::expectFilterAdded( 'authenticate', [ $this->testee, 'authenticate' ], 20 ); + WP_Mock::expectFilterAdded( 'rtcamp.google_redirect_url', [ $this->testee, 'redirect_url' ] ); + WP_Mock::expectFilterAdded( 'rtcamp.google_register_user', [ $this->authenticatorMock, 'register' ] ); + WP_Mock::expectFilterAdded( 'rtcamp.google_login_state', [ $this->testee, 'state_redirect' ] ); $this->testee->init(); $this->assertConditionsMet(); diff --git a/tests/php/Unit/PluginTest.php b/tests/php/Unit/PluginTest.php index 12eec8df..f89b1b14 100644 --- a/tests/php/Unit/PluginTest.php +++ b/tests/php/Unit/PluginTest.php @@ -287,7 +287,7 @@ public function testHooksAddedOnRun() { ); WP_Mock::expectActionAdded( 'init', [ $this->testee, 'load_translations' ] ); - WP_Mock::expectActionAdded( 'plugin_action_links_' . plugin_basename( $this->testee->path ) . '/login-with-google.php', [ $this->testee, 'add_plugin_action_links' ] ); + WP_Mock::expectFilterAdded( 'plugin_action_links_' . plugin_basename( $this->testee->path ) . '/login-with-google.php', [ $this->testee, 'add_plugin_action_links' ] ); WP_Mock::expectFilter( 'rtcamp.google_login_modules', $this->testee->active_modules ); $this->testee->run();