public function test_user_logged_in_does_nothing()
 {
     Phake::when($this->facade)->is_user_logged_in()->thenReturn(false);
     $this->client->launchkey_still_authenticated_heartbeat();
     Phake::verify($this->facade)->is_user_logged_in();
     Phake::verifyNoFurtherInteraction($this->facade);
 }
 public function test_does_nothing_when_user_cannot_manage_options()
 {
     Phake::when($this->facade)->current_user_can('manage_options')->thenReturn(false);
     $this->wizard->wizard_submit_ajax();
     Phake::verify($this->facade)->current_user_can('manage_options');
     Phake::verifyNoFurtherInteraction($this->facade);
 }
 public function test_no_current_user_does_nothing()
 {
     Phake::when($this->facade)->wp_get_current_user()->thenReturn(null);
     $this->client->logout();
     Phake::verifyNoInteraction($this->sdk_auth);
     Phake::verifyNoFurtherInteraction($this->facade);
 }
 public function test_launchkey_sso_session_redirects_to_logout_url_and_exits()
 {
     $this->user->launchkey_sso_session = "Not Null";
     $this->client->logout();
     Phake::inOrder(Phake::verify($this->facade)->wp_redirect(static::LOGOUT_URL), Phake::verify($this->facade)->_exit(Phake::anyParameters()));
     Phake::verifyNoFurtherInteraction($this->facade);
 }
 public function test_does_nothing_else_when_nonce_is_invalid()
 {
     $_REQUEST['nonce'] = 'not empty';
     Phake::when($this->facade)->wp_verify_nonce(Phake::anyParameters())->thenReturn(false);
     $this->wizard->verify_configuration_callback();
     Phake::verify($this->facade)->wp_verify_nonce(Phake::anyParameters());
     Phake::verifyNoFurtherInteraction($this->facade);
 }
 public function test_no_current_user_does_nothing()
 {
     Phake::when($this->facade)->wp_get_current_user(Phake::anyParameters())->thenReturn(null);
     $this->client->white_label_pair_callback();
     Phake::verify($this->facade)->wp_get_current_user();
     Phake::verifyNoFurtherInteraction($this->facade);
     Phake::verifyNoInteraction($this->sdk_auth);
 }
 public function test_does_nothing_but_create_nonce_when_nonce_is_invalid()
 {
     $_POST['nonce'] = 'not empty';
     Phake::when($this->facade)->wp_verify_nonce(Phake::anyParameters())->thenReturn(false);
     $this->wizard->wizard_submit_ajax();
     Phake::verify($this->facade)->wp_verify_nonce(Phake::anyParameters());
     Phake::verifyNoFurtherInteraction($this->facade);
 }
Exemple #8
0
 public function testVerifyNoFurtherInteractionPassesStrict()
 {
     Phake::setClient(Phake::CLIENT_PHPUNIT);
     $mock = Phake::mock('stdClass');
     $assertionCount = self::getCount();
     Phake::verifyNoFurtherInteraction($mock);
     $newAssertionCount = self::getCount();
     $this->assertGreaterThan($assertionCount, $newAssertionCount);
 }
Exemple #9
0
 public function testPrimaryKeyCachesResult()
 {
     $ids = $this->driver->primaryKey('some_stuff');
     $this->assertEquals(array('some_id', 'stuff_id'), $ids);
     Phake::verifyNoFurtherInteraction($this->pdo);
     $ids = $this->driver->primaryKey('some_stuff');
     $this->assertEquals(array('some_id', 'stuff_id'), $ids);
 }
 public function test_when_token_invalid_and_refresh_token_exists_and_refresh_returns_no_access_token__user_is_logged_out_and_redirected()
 {
     Phake::when($this->facade)->wp_remote_post('https://oauth.launchkey.com/access_token', $this->anything())->thenReturn(array('body' => '{"refresh_token": "New Refresh Token", "expires_in": 9999}'));
     $this->client->launchkey_admin_callback();
     Phake::verify($this->facade)->wp_login_url();
     Phake::inOrder(Phake::verify($this->facade)->wp_logout(), Phake::verify($this->facade)->wp_redirect('LoginURL?loggedout=1'));
     Phake::verifyNoFurtherInteraction($this->facade);
 }
 public function test_not_saml_triggered_with_no_username_no_password_and_current_user_with_launchkey_username_and_launchkey_authorized_not_false_does_nothing()
 {
     unset($_REQUEST['SAMLResponse']);
     unset($_REQUEST['SAMLRequest']);
     $this->user->launchkey_username = "******";
     $this->user->launchkey_authorized = "true";
     $this->client->authenticate($this->user, null, null);
     Phake::verify($this->facade)->wp_get_current_user();
     Phake::verifyNoFurtherInteraction($this->facade);
 }
 public function test_does_nothing_else_when_user_cannot_manage_options()
 {
     Phake::when($this->facade)->current_user_can('manage_options')->thenReturn(false);
     $this->wizard->verify_configuration_callback();
     Phake::verify($this->facade)->current_user_can('manage_options');
     Phake::verifyNoFurtherInteraction($this->facade);
 }