/** * @param $key * @param $expected * * @dataProvider data_provider_test_post_get_option_filter_has_expected_defaults */ public function test_post_get_option_filter_has_expected_defaults($key, $expected) { $options[LaunchKey_WP_Options::OPTION_IMPLEMENTATION_TYPE] = LaunchKey_WP_Implementation_Type::NATIVE; $output = $this->options->post_get_option_filter($options); $this->assertArrayHasKey($key, $output); $this->assertSame($expected, $output[$key]); }
protected function setUp() { Phake::initAnnotations($this); $this->options = LaunchKey_WP_Options::get_defaults(); Phake::when($this->facade)->settings_fields(Phake::anyParameters())->thenReturn('settings_fields response'); Phake::when($this->facade)->do_settings_sections(Phake::anyParameters())->thenReturn('do_settings_sections response'); Phake::when($this->facade)->submit_button(Phake::anyParameters())->thenReturn('submit_button response'); $that = $this; Phake::when($this->facade)->get_option(Phake::anyParameters())->thenReturnCallback(function () use($that) { return $that->options; }); Phake::when($this->template)->render_template(Phake::anyParameters())->thenReturnCallback(function ($template) { return sprintf('Rendered [%s]', $template); }); Phake::when($this->facade)->__(Phake::anyParameters())->thenReturnCallback(function ($method, $parameters) { return sprintf('TRANSLATED [%s]', $parameters[0]); }); Phake::when($this->facade)->admin_url(Phake::anyParameters())->thenReturnCallback(function ($method, $parameters) { return sprintf('AdminURL [%s]', isset($parameters[0]) ? $parameters[0] : "ROOT"); }); Phake::when($this->facade)->wp_login_url(Phake::anyParameters())->thenReturnCallback(function ($method, $parameters) { return sprintf('LoginURL [%s]', isset($parameters[0]) ? $parameters[0] : "ROOT"); }); Phake::when($this->facade)->parse_url(Phake::anyParameters())->thenReturn("Parsed URL"); Phake::when($this->facade)->wp_get_current_user()->thenReturn((object) array('user_login' => "login")); $this->admin = new LaunchKey_WP_Admin($this->facade, $this->template, $this->language_domain, false); }
/** * @param $key * @param $expected * * @dataProvider data_provider_test_post_get_option_filter_has_expected_defaults */ public function test_post_get_option_filter_has_expected_defaults($key, $expected) { $output = $this->options->post_get_option_filter(array()); $this->assertArrayHasKey($key, $output); $this->assertSame($expected, $output[$key]); }