/** * When $args and $instance is merged, make sure that the $args values have precedence, * otherwise $instance might overwrite before_widget, after_widget, etc */ function test_merge_args_instance_order() { $widget = new UTCW_Widget(); $args = array('before_widget' => 'Hello World'); $instance = array('before_widget' => 'Goodbye World'); $this->expectOutputRegex('/Hello World/'); $widget->widget($args, $instance); }
function test_widget_converts_empty_checkbox_values_to_false() { $widget = new UTCW_Widget(); $test_render_config = new UTCW_Test_Render_Config(); $test_data_config = new UTCW_Test_Data_Config(); $defaults = array_merge($test_render_config->defaults, $test_data_config->defaults); $booleans = array(); foreach ($defaults as $key => $value) { if (is_bool($value)) { $booleans[] = $key; } } $instance = $widget->update(array(), array()); foreach ($booleans as $boolean) { $this->assertEquals(false, $instance[$boolean], 'The boolean configuration option ' . $boolean . ' needs to be converted to false when not present in input'); } }