/** * @dataProvider provider_implementation_types_that_require_private_key * * @param $implementation_type */ public function test_no_private_key_errors_for_implementation_types_that_require_private_key($implementation_type) { $this->options[LaunchKey_WP_Options::OPTION_PRIVATE_KEY] = null; $this->options[LaunchKey_WP_Options::OPTION_IMPLEMENTATION_TYPE] = LaunchKey_WP_Implementation_Type::OAUTH; list($actual, $errors) = $this->client->check_option(array('implementation_type' => $implementation_type)); $this->assertContains('TRANSLATED [Private Key is required]', $errors); $this->assertEquals($implementation_type, $actual[LaunchKey_WP_Options::OPTION_IMPLEMENTATION_TYPE], 'check_option returned and unexpected implementation type'); }
public function test_file_read_adds_error() { $_FILES['sso_idp']['tmp_name'] = tempnam(sys_get_temp_dir(), "TEST"); list($options, $errors) = $this->admin->check_option($this->options); $this->assertNotEmpty($errors, "No errors when error was expected"); $this->assertStringStartsWith("TRANSLATED [The SSO Profile file provided had an error being parsed]: Could not load given string as XML into DOMDocument", $errors[0]); unlink($_FILES['sso_idp']['tmp_name']); }
public function wizard_submit_ajax() { if (isset($_POST['nonce'])) { if ($this->wp_facade->wp_verify_nonce($_POST['nonce'], static::WIZARD_NONCE_KEY)) { list($options, $errors) = $this->admin->check_option($_POST); if ($errors) { $response["errors"] = $errors; } else { $this->wp_facade->update_option(LaunchKey_WP_Admin::OPTION_KEY, $options); } $response['nonce'] = $this->wp_facade->wp_create_nonce(static::WIZARD_NONCE_KEY); } else { $response["errors"] = $this->wp_facade->__("An error occurred submitting the page. Please refresh the page and submit again."); } $this->wp_facade->wp_send_json($response); } }