Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Modules/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ] );
}

Expand Down
2 changes: 1 addition & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ] );
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/php/Unit/Modules/LoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Unit/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down