/** * return custom config data for our tests */ public function go_config_filter($config, $which) { if ('go-mailchimp' == $which) { $config = array('api_key' => '11d906093832805923d53aaf9f56a9de-us1', 'lists' => array('a3e91a3095' => array('id' => 'a3e91a3095', 'name' => 'Test General Users', 'slug' => 'general_users', 'webhook_secret' => '1234zyxw', 'field_map' => array('EMAIL' => array('function' => array(go_syncuser_map(), 'user_meta'), 'args' => array('user_email')))))); } //END if return $config; }
/** * maps list groupings to a collection of group functions specified in the config * * @param $user WP_User User being synchronized * @param $config array Configuration for a "GROUPINGS" field */ public function map_groupings($user, $config) { $groups = array(); foreach ($config as $group) { $field_value = go_syncuser_map()->map_field($user, $group); $groups[] = array('name' => $group['name'], 'groups' => $field_value); } //END foreach return $groups; }
/** * make sure we can get an instance of our plugin */ public function test_singleton() { $this->assertTrue(function_exists('go_syncuser_map')); $this->assertTrue(is_object(go_syncuser_map())); }