/** * @param $cookie_name * * @dataProvider cookie_name_provider */ public function test_launchkey_logout_expires_cookies($cookie_name) { $_COOKIE['launchkey_access_token'] = 'access token'; $this->client->launchkey_logout(); Phake::verify($this->facade)->current_time('timestamp', true); Phake::verify($this->facade)->setcookie($cookie_name, '1', $this->current_time - 60, COOKIEPATH, COOKIE_DOMAIN); }
public function test_launchkey_admin_callback_admin_pair_updates_launchkey_user_from_cookie_when_launchkey_user_cookie_is_set_and_valid() { $_COOKIE['launchkey_user'] = '******'; $_GET['launchkey_admin_pair'] = '1'; $this->client->launchkey_admin_callback(); Phake::verify($this->facade)->update_user_meta(12345, 'launchkey_user', '1234567890123456'); }
public function test_login_url_in_context() { $this->options[LaunchKey_WP_Options::OPTION_ROCKET_KEY] = 12345; Phake::when($this->facade)->admin_url(Phake::anyParameters())->thenReturn('admin url'); $this->client->launchkey_form(); Phake::verify($this->template)->render_template('launchkey-form', Phake::capture($context)); Phake::verify($this->facade)->_echo('Rendered [launchkey-form]'); $this->assertArrayHasKey('login_url', $context); return $context['login_url']; }
/** * @depends test_remote_get_success_looks_up_user */ public function test_remote_get_success_new_user_who_can_not_manage_options_sets_the_proper_cookies_and_redirects_to_login() { Phake::when($this->facade)->current_user_can(Phake::anyParameters())->thenReturn(false); $this->client->launchkey_callback(); Phake::verify($this->facade)->current_user_can('manage_options'); Phake::verify($this->facade)->setcookie('launchkey_access_token', 'OAuth Access Token', $this->timestamp + 86400 * 30, COOKIEPATH, COOKIE_DOMAIN); Phake::verify($this->facade)->setcookie('launchkey_refresh_token', 'OAuth Refresh_token', $this->timestamp + 86400 * 30, COOKIEPATH, COOKIE_DOMAIN); Phake::verify($this->facade)->setcookie('launchkey_expires', $this->timestamp + $this->expires_in, $this->timestamp + 86400 * 30, COOKIEPATH, COOKIE_DOMAIN); Phake::verify($this->facade)->wp_redirect('loginURL?launchkey_pair=1'); }
public function test_uses_get_site_option_when_multi_site() { $client = new LaunchKey_WP_OAuth_Client($this->facade, $this->template, true); $client->launchkey_form(); Phake::verify($this->facade)->get_site_option(LaunchKey_WP_Admin::OPTION_KEY); }
public function test_register_admin_actions_adds_action_admin_init_when_admin() { Phake::when($this->facade)->is_admin()->thenReturn(true); $this->client->register_actions(); Phake::verify($this->facade)->add_action('admin_init', array($this->client, 'launchkey_admin_callback')); }
public function test_style_passes_to_launchkey_form() { $this->client->launchkey_shortcode(array('style' => 'stylie')); Phake::verify($this->client)->launchkey_form($this->anything(), $this->anything(), 'stylie'); }