diff --git a/docker-tasks/run-local-app/docker-compose.yml b/docker-tasks/run-local-app/docker-compose.yml index 7423fe1eb..92a4f19f7 100644 --- a/docker-tasks/run-local-app/docker-compose.yml +++ b/docker-tasks/run-local-app/docker-compose.yml @@ -12,6 +12,7 @@ services: WORDPRESS_DB_PASSWORD: 'testing' volumes: - "${PWD}:/var/www/html/wp-content/plugins/wp-graphql:ro" + - ./uploads.txt:/usr/local/etc/php/conf.d/uploads.ini mysql_test: image: "${MYSQL_DOCKER_IMAGE}" diff --git a/docker-tasks/run-local-app/uploads.txt b/docker-tasks/run-local-app/uploads.txt new file mode 100644 index 000000000..c09282bb6 --- /dev/null +++ b/docker-tasks/run-local-app/uploads.txt @@ -0,0 +1,5 @@ +file_uploads = On +memory_limit = 64M +upload_max_filesize = 64M +post_max_size = 64M +max_execution_time = 600 \ No newline at end of file diff --git a/src/Data/DataSource.php b/src/Data/DataSource.php index 1aced867d..95e20c614 100755 --- a/src/Data/DataSource.php +++ b/src/Data/DataSource.php @@ -328,6 +328,88 @@ public static function resolve_theme( $stylesheet ) { } } + /** + * Retrieves and formats theme modification data + * + * @param array|null $theme_mods - array of raw theme modification data + * @return array|null + */ + public static function resolve_theme_mods_data() { + /** + * Output array + */ + $theme_mod_data = []; + + /** + * Loop through raw active theme mods array and format theme mod data + */ + + $theme_mods = array_merge( + get_theme_mods(), + [ + 'background_image' => get_theme_mod( 'background_image', get_theme_support( 'custom-background', 'default-image' ) ), + 'background_color' => get_theme_mod( 'background_color', get_theme_support( 'custom-background', 'default-color' ) ), + ] + ); + + foreach( $theme_mods as $mod_name => $mod_data ){ + if( gettype($mod_name) === 'integer' ) continue; // Skip mods without keys + if( $mod_name === 'sidebars_widgets' ) continue; // Skip sidebars + + switch( $mod_name ) { + /** + * Custom CSS Post Id + */ + case 'custom_css_post_id': + $theme_mod_data[ $mod_name ] = absint($mod_data); + break; + + /** + * Background + */ + case 'background_preset': + case 'background_size': + case 'background_repeat': + case 'background_attachment': + $key = str_replace('background_', '', $mod_name ); + $theme_mod_data[ 'background' ][ $key ] = $mod_data; + break; + case 'background_image': + $theme_mod_data[ 'background' ]['id'] = attachment_url_to_postid( (string) $mod_data ); + break; + case 'background_color': + $theme_mod_data[ $mod_name ] = (string) $mod_data; + break; + + /** + * Custom Logo + */ + case 'custom_logo': + $theme_mod_data[ $mod_name ] = absint( $mod_data ); + break; + + /** + * Header Image + */ + case 'header_image_data': + if ( ! isset( $theme_mod_data[ 'header_image' ] ) ) $theme_mod_data[ 'header_image' ] = []; + $theme_mod_data[ 'header_image' ] += get_object_vars( $mod_data ); + break; + case 'header_image': + $theme_mod_data[ 'header_image' ]['id'] = attachment_url_to_postid( (string) $mod_data ); + break; + + /** + * Nav Menu Locations and Custom Mods + */ + default: + $theme_mod_data[ $mod_name ] = $mod_data; + } + + } + return $theme_mod_data; + } + /** * Wrapper for the ThemesConnectionResolver::resolve method * @@ -766,4 +848,12 @@ public static function get_post_object_by_uri( $uri, $output = OBJECT, $post_typ return null; } + + /** + * Returns an array of nav menu location names + */ + public static function get_registered_nav_menu_locations() { + global $_wp_registered_nav_menus; + return array_keys( $_wp_registered_nav_menus ); + } } diff --git a/src/Data/ThemeModsMutation.php b/src/Data/ThemeModsMutation.php new file mode 100644 index 000000000..3f0cad957 --- /dev/null +++ b/src/Data/ThemeModsMutation.php @@ -0,0 +1,119 @@ + $value ) { + switch( $key ) { + case 'imageId': + $value_key = 'background_image'; + $prepared_values[ $value_key ] = wp_get_attachment_url( $value ); + break; + default: + $value_key = 'background_'. preg_replace( '/([A-Z])/', '_\\L$1', $key ); + $prepared_values[ $value_key ] = $value; + } + } + } + + if ( ! empty( $input['headerImage'] ) && is_array( $input['headerImage'] ) ) { + + $data_key = 'header_image_data'; + foreach( $input['headerImage'] as $key => $value ) { + switch( $key ) { + case 'imageId': + $url = wp_get_attachment_url( $value ); + $value_key = 'header_image'; + $prepared_values[ $value_key ] = $url; + + if( empty( $prepared_values[ $data_key ] ) ) { + $prepared_values[ $data_key ] = get_theme_mod( $data_key, new \stdClass ); + } + $prepared_values[ $data_key ]->url = $url; + break; + + default: + if( empty( $prepared_values[ $data_key ] ) ) { + $prepared_values[ $data_key ] = get_theme_mod( $data_key, new \stdClass ); + } + $value_name = 'background_'. preg_replace( '/([A-Z])/', '_\\L$1', $key ); + $prepared_values[ $data_key ]->$value_name = $value; + + } + } + } + + if ( ! empty( $input['navMenuLocations'] ) && is_array( $input['navMenuLocations'] ) ) { + $prepared_values[ 'nav_menu_locations' ] = array_merge( + get_nav_menu_locations(), + $input['navMenuLocations'] + ); + } + + /** + * Filter the $theme_mods_update_values + * + * @param array $prepared_values The array of theme mods values that will be passed to set_theme_mod + * @param array $input The data that was entered as input for the mutation + * @param string $mutation_type The type of mutation being performed ( create, edit, etc ) + */ + $prepared_values = apply_filters( 'graphql_theme_mods_update_values', $prepared_values, $input, $mutation_name ); + + return $prepared_values; + } + + /** + * Updates theme modifications with $theme_mods_args array + * + * @param array $theme_mods_args - new values for theme mods + * @return boolean - true on success and false on fail + */ + public static function update_theme_mods( $theme_mods_args ) { + + if( is_array( $theme_mods_args ) && ! empty( $theme_mods_args ) ) { + foreach( $theme_mods_args as $name => $value ) { + set_theme_mod( $name, $value ); + } + return true; + } + + return false; + + } + +} \ No newline at end of file diff --git a/src/Mutation/UpdateThemeMods.php b/src/Mutation/UpdateThemeMods.php new file mode 100644 index 000000000..9aa7d6911 --- /dev/null +++ b/src/Mutation/UpdateThemeMods.php @@ -0,0 +1,91 @@ + self::get_input_fields(), + 'outputFields' => [ + 'themeMods' => [ + 'type' => 'ThemeMods', + 'resolve' => function ( $payload ) { + return $payload; + }, + ], + ], + 'mutateAndGetPayload' => function ( $input ) { + /** + * Check that the user can manage setting options + */ + if ( ! current_user_can( 'edit_theme_options' ) ) { + throw new UserError( + __( 'Sorry, you are not allowed to edit theme settings as this user.', 'wp-graphql' ) + ); + } + + $prepared_values = ThemeModsMutation::prepare_theme_mods_values( $input, 'update' ); + + /** + * Update theme mods + */ + $success = ThemeModsMutation::update_theme_mods( $prepared_values ); + + /** + * Throw an exception if update + */ + if ( ! $success ) { + throw new UserError( __( 'The updates to theme settings failed to save', 'wp-graphql' ) ); + } + + /** + * Return the payload + */ + return DataSource::resolve_theme_mods_data(); + } + ] ); + } + + /** + * Returns the input_fields definition + * + * @return mixed|array|null $input_fields + */ + private static function get_input_fields() { + return [ + 'background' => [ + 'type' => 'CustomBackgroundInput', + 'description' => __( 'The theme mod "background" object', 'wp-graphql' ), + ], + 'backgroundColor' => [ + 'type' => 'String', + 'description' => __( 'The theme mod "background-color" hex color code', 'wp-graphql' ), + ], + 'customCssPost' => [ + 'type' => 'Int', + 'description' => __( 'The theme mod "custom-css-post-id" post id', 'wp-graphql' ), + ], + 'customLogo' => [ + 'type' => 'Int', + 'description' => __( 'The theme mod "custom-logo" attachment id', 'wp-graphql' ), + ], + 'headerImage' => [ + 'type' => 'CustomHeaderInput', + 'description' => __( 'The theme mod "header-image" object', 'wp-graphql' ), + ], + 'navMenuLocations' => [ + 'type' => 'NavMenuLocationsInput', + 'description' => __( 'The theme mod "nav-menu-locations" object', 'wp-graphql' ), + ], + ]; + } +} \ No newline at end of file diff --git a/src/Type/Enum/MenuLocationEnum.php b/src/Type/Enum/MenuLocationEnum.php index 0d1c1b997..236df80ca 100644 --- a/src/Type/Enum/MenuLocationEnum.php +++ b/src/Type/Enum/MenuLocationEnum.php @@ -1,12 +1,14 @@ $location, ]; diff --git a/src/Type/Input/CustomBackgroundInput.php b/src/Type/Input/CustomBackgroundInput.php new file mode 100644 index 000000000..8c1e01ff5 --- /dev/null +++ b/src/Type/Input/CustomBackgroundInput.php @@ -0,0 +1,28 @@ + __( 'Custom background values', 'wp-graphql' ), + 'fields' => [ + 'imageId' => [ + 'type' => 'ID', + 'description' => __( 'The theme mod "background"\'s image attachment id', 'wp-graphql' ), + ], + 'preset' => [ + 'type' => 'String', + 'description' => __( 'The theme mod "background"\'s preset property', 'wp-graphql' ), + ], + 'size' => [ + 'type' => 'String', + 'description' => __( 'The theme mod "background"\'s css background-size property', 'wp-graphql' ), + ], + 'repeat' => [ + 'type' => 'String', + 'description' => __( 'The theme mod "background"\'s css background-repeat property', 'wp-graphql' ), + ], + 'attachment' => [ + 'type' => 'String', + 'description' => __( 'The theme mod "background"\'s css background-attachement property', 'wp-graphql' ), + ], + ], +] ); \ No newline at end of file diff --git a/src/Type/Input/CustomHeaderInput.php b/src/Type/Input/CustomHeaderInput.php new file mode 100644 index 000000000..596a144c3 --- /dev/null +++ b/src/Type/Input/CustomHeaderInput.php @@ -0,0 +1,24 @@ + __( 'Custom header values', 'wp-graphql' ), + 'fields' => [ + 'imageId' => [ + 'type' => 'ID', + 'description' => __( 'The theme mod "header-image"\'s image attachment id', 'wp-graphql' ), + ], + 'thumbnailUrl' => [ + 'type' => 'String', + 'description' => __( 'The theme mod "header-image"\'s thumbnail url', 'wp-graphql' ), + ], + 'height' => [ + 'type' => 'Int', + 'description' => __( 'The theme mod "header-image"\'s display width in pixels', 'wp-graphql' ), + ], + 'width' => [ + 'type' => 'Int', + 'description' => __( 'The theme mod "header-image"\'s display height in pixels', 'wp-graphql' ), + ], + ] +] ); \ No newline at end of file diff --git a/src/Type/Input/NavMenuLocationsInput.php b/src/Type/Input/NavMenuLocationsInput.php new file mode 100644 index 000000000..d22ffbdee --- /dev/null +++ b/src/Type/Input/NavMenuLocationsInput.php @@ -0,0 +1,25 @@ + 'ID', + 'description' => __( 'The WP ID of the nav menu to be assigned to %s', 'wp-graphql', $location ), + ]; + } + } + + return $fields; +} + + +register_graphql_input_type( 'NavMenuLocationsInput', [ + 'description' => __( 'Nav menu location values', 'wp-graphql' ), + 'fields' => get_fields(), +] ); \ No newline at end of file diff --git a/src/Type/Object/ThemeMods.php b/src/Type/Object/ThemeMods.php new file mode 100644 index 000000000..141904be7 --- /dev/null +++ b/src/Type/Object/ThemeMods.php @@ -0,0 +1,97 @@ + __( 'All of registered theme modifications', 'wp-graphql' ), + 'interfaces' => [ WPObjectType::node_interface() ], + 'fields' => [ + 'background' => [ + 'type' => 'MediaItem', + 'description' => __( 'custom background', 'wp-graphql' ), + 'resolve' => function( $root, $args, $context, $info ) { + if( ! empty( $root['background'] ) ) { + return ( ! empty( $root['background']['id'] ) ) ? + DataSource::resolve_post_object( absint( $root['background']['id'] ), 'attachment' ) : + null; + } + + return null; + } + ], + 'backgroundColor' => [ + 'type' => 'String', + 'description' => __( 'background color', 'wp-graphql' ), + 'resolve' => function( $root, $args, $context, $info ) { + return ( ! empty( $root['background_color'] ) ) ? $root['background_color'] : null; + } + ], + 'customCssPostId' => [ + 'type' => 'Int', + 'description' => __( 'WP ID of WP Post storing theme custom CSS', 'wp-graphql' ), + 'resolve' => function( $root, $args, $context, $info ) { + return ( ! empty( $root['custom_css_post_id'] ) ) ? + absint( $root['custom_css_post_id'] ) : + null; + } + ], + 'customCss' => [ + 'type' => 'Post', + 'description' => __( 'WP Post storing theme custom CSS (temporary)', 'wp-graphql' ), + 'resolve' => function( $root, $args, $context, $info ) { + return ( ! empty( $root['custom_css_post_id'] ) ) ? + DataSource::resolve_post_object( absint( $root['custom_css_post_id'] ), 'post' ) : + null; + } + ], + 'customLogo' => [ + 'type' => 'MediaItem', + 'description' => __( 'Site Custom Logo', 'wp-graphql' ), + 'resolve' => function( $root, $args, $context, $info ){ + return ( ! empty( $root['custom_logo'] ) ) ? + DataSource::resolve_post_object( absint( $root['custom_logo'] ), 'attachment' ) : + null; + } + ], + 'headerImage' => [ + 'type' => 'MediaItem', + 'description' => __( 'custom header image', 'wp-graphql' ), + 'resolve' => function( $root, $args, $context, $info ){ + if( ! empty ( $root['header_image'] ) ) { + return ( ! empty( $root['header_image']['id'] ) ) ? + DataSource::resolve_post_object( absint( $root['header_image']['id'] ), 'attachment' ) : + null; + } + + return null; + }, + ], + 'navMenu' => [ + 'type' => 'Menu', + 'description' => __( 'Menus are the containers for navigation items. Menus can be assigned to menu locations, which are typically registered by the active theme.', 'wp-graphql' ), + 'args' => [ + 'location' => [ + 'type' => ['non_null' => 'MenuLocationEnum'], + 'description' => __( 'The menu location for the menu being queried', 'wp-graphql' ) + ], + ], + 'resolve' => function($root, $args, $context, $info ) { + if ( empty ( $root['nav_menu_locations'] ) ) return null; + + $location = $args[ 'location' ]; + return ( ! empty( $root['nav_menu_locations'][ $location ] ) ) ? + DataSource::resolve_term_object( absint( $root['nav_menu_locations'][ $location ] ), 'nav_menu' ) : + null; + } + ] + ] +] ); + +register_graphql_field( 'RootQuery', 'themeMods', [ + 'type' => 'ThemeMods', + 'resolve' => function () { + return DataSource::resolve_theme_mods_data(); + } +] ); \ No newline at end of file diff --git a/src/TypeRegistry.php b/src/TypeRegistry.php index aa79bdc5b..f283611c0 100644 --- a/src/TypeRegistry.php +++ b/src/TypeRegistry.php @@ -27,6 +27,7 @@ use WPGraphQL\Mutation\TermObjectCreate; use WPGraphQL\Mutation\TermObjectDelete; use WPGraphQL\Mutation\TermObjectUpdate; +use WPGraphQL\Mutation\UpdateThemeMods; use WPGraphQL\Mutation\UpdateSettings; use WPGraphQL\Mutation\UserCreate; use WPGraphQL\Mutation\UserDelete; @@ -113,6 +114,10 @@ public static function init() { require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Object/Settings.php' ); require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Enum/TermObjectsConnectionOrderbyEnum.php' ); require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Object/Theme.php' ); + require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Object/ThemeMods.php' ); + require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Input/CustomBackgroundInput.php' ); + require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Input/CustomHeaderInput.php' ); + require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Input/NavMenuLocationsInput.php' ); require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Object/Taxonomy.php' ); require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Enum/TaxonomyEnum.php' ); require_once( WPGRAPHQL_PLUGIN_DIR . 'src/Type/Object/User.php' ); @@ -220,6 +225,7 @@ public static function init() { MediaItemCreate::register_mutation(); MediaItemDelete::register_mutation(); MediaItemUpdate::register_mutation(); + UpdateThemeMods::register_mutation(); UserCreate::register_mutation(); UserDelete::register_mutation(); UserUpdate::register_mutation(); diff --git a/tests/wpunit/ThemeModsMutationsTest.php b/tests/wpunit/ThemeModsMutationsTest.php new file mode 100644 index 000000000..7d96e9616 --- /dev/null +++ b/tests/wpunit/ThemeModsMutationsTest.php @@ -0,0 +1,318 @@ +client_mutation_id = 'someUniqueId'; + $this->author = $this->factory()->user->create( [ + 'role' => 'author', + ] ); + $this->admin = $this->factory()->user->create( [ + 'role' => 'administrator', + ] ); + $this->subscriber = $this->factory()->user->create( [ + 'role' => 'subscriber', + ] ); + $this->logo_id = $this->createPostObject( [ + 'post_type' => 'attachment', + 'post_content' => 'some logo', + ] ); + $this->background_id = $this->createPostObject( [ + 'post_type' => 'attachment', + 'post_content' => 'some background', + ] ); + $this->background_color = 'dd56d3'; + $this->header_id = $this->createPostObject( [ + 'post_type' => 'attachment', + 'post_content' => 'some header', + ] ); + $this->custom_css_post_id = $this->createPostObject( [ + 'post_type' => 'post', + 'post_content' => '

some css

', + ] ); + $this->nav_menu_id = wp_create_nav_menu( 'My Menu' ); + + } + + public function tearDown() { + // your tear down methods here + + // then + parent::tearDown(); + } + + public function createPostObject( $args ) { + + /** + * Set up the $defaults + */ + $defaults = [ + 'post_author' => $this->admin, + 'post_content' => 'Test page content', + 'post_excerpt' => 'Test excerpt', + 'post_status' => 'publish', + 'post_title' => 'Test Title', + 'post_type' => 'post', + 'post_date' => $this->current_date, + ]; + + /** + * Combine the defaults with the $args that were + * passed through + */ + $args = array_merge( $defaults, $args ); + + /** + * Create the page + */ + $post_id = $this->factory->post->create( $args ); + + /** + * Update the _edit_last and _edit_lock fields to simulate a user editing the page to + * test retrieving the fields + * + * @since 0.0.5 + */ + update_post_meta( $post_id, '_edit_lock', $this->current_time . ':' . $this->admin ); + update_post_meta( $post_id, '_edit_last', $this->admin ); + + /** + * Return the $id of the post_object that was created + */ + return $post_id; + + } + + // tests + public function testThemeModsMutation() + { + + wp_set_current_user( $this->admin ); + + /** + * Test mutation + */ + $query = ' + mutation themeModsMutation( + $clientMutationId: String! + $background: CustomBackgroundInput, + $backgroundColor: String, + $customCssPost: Int, + $customLogo: Int, + $headerImage: CustomHeaderInput, + $navMenuLocations: NavMenuLocationsInput + ){ + updateThemeMods( input: { + clientMutationId: $clientMutationId + background: $background, + backgroundColor: $backgroundColor, + customCssPost: $customCssPost, + customLogo: $customLogo, + headerImage: $headerImage, + navMenuLocations: $navMenuLocations, + } ) { + clientMutationId + themeMods { + backgroundColor + customCssPostId + customCss { + postId + content + } + customLogo { + mediaItemId + } + navMenu( location: MY_MENU_LOCATION ) { + menuId + name + } + } + } + } + '; + + $variables = [ + 'clientMutationId' => $this->client_mutation_id, + 'background' => [ + 'imageId' => $this->background_id, + 'preset' => 'default', + 'size' => '50% 100%', + 'repeat' => 'no-repeat', + 'attachment' => 'fixed', + ], + 'backgroundColor' => $this->background_color, + 'customCssPost' => $this->custom_css_post_id, + 'customLogo' => $this->logo_id, + 'headerImage' => [ + 'imageId' => $this->header_id, + 'height' => 384, + 'width' => 1175, + ], + 'navMenuLocations' => [ 'my-menu-location' => $this->nav_menu_id ], + ]; + + $actual = do_graphql_request( $query, 'themeModsMutation', $variables ); + + /** + * Can't retrieve test header or background image due to no files + * being in the wp upload directory + */ + $expected = [ + 'data' => [ + 'updateThemeMods' => [ + 'clientMutationId' => $this->client_mutation_id, + 'themeMods' => [ + 'backgroundColor' => $this->background_color, + 'customLogo' => [ + 'mediaItemId' => $this->logo_id, + ], + 'customCssPostId' => $this->custom_css_post_id, + 'customCss' => [ + 'postId' => $this->custom_css_post_id, + 'content' => '

some css

+', + ], + 'navMenu' => [ + 'menuId' => $this->nav_menu_id, + 'name' => 'My Menu', + ], + ], + ], + ], + ]; + + /** + * use --debug flag to view + */ + \Codeception\Util\Debug::debug( $actual ); + + /** + * Compare the actual output vs the expected output + */ + $this->assertEquals( $expected, $actual ); + + } + + public function testThemeModsMutationNotAuthorized() + { + + wp_set_current_user( $this->subscriber ); + + /** + * Test mutation + */ + $query = ' + mutation themeModsMutation( + $clientMutationId: String! + $background: CustomBackgroundInput, + $backgroundColor: String, + $customCssPost: Int, + $customLogo: Int, + $headerImage: CustomHeaderInput, + $navMenuLocations: NavMenuLocationsInput + ){ + updateThemeMods( input: { + clientMutationId: $clientMutationId + background: $background, + backgroundColor: $backgroundColor, + customCssPost: $customCssPost, + customLogo: $customLogo, + headerImage: $headerImage, + navMenuLocations: $navMenuLocations, + } ) { + clientMutationId + themeMods { + background { + mediaItemId + } + backgroundColor + customCssPostId + customCss { + postId + content + } + customLogo { + mediaItemId + } + headerImage { + mediaItemId + } + navMenu(location: MY_MENU_LOCATION) { + menuId + name + } + } + } + } + '; + + $variables = [ + 'clientMutationId' => $this->client_mutation_id, + 'background' => [ + 'imageId' => $this->background_id, + 'preset' => 'default', + 'size' => '50% 100%', + 'repeat' => 'no-repeat', + 'attachment' => 'fixed', + ], + 'backgroundColor' => $this->background_color, + 'customCssPost' => $this->custom_css_post_id, + 'customLogo' => $this->logo_id, + 'headerImage' => [ + 'imageId' => $this->header_id, + 'height' => 384, + 'width' => 1175, + ], + 'navMenuLocations' => [ 'my-menu-location' => $this->nav_menu_id ], + ]; + + $actual = do_graphql_request( $query, 'themeModsMutation', $variables ); + + $expected = [ + 'errors' => [ + [ + 'message' => 'Sorry, you are not allowed to edit theme settings as this user.', + 'category' => 'user', + 'locations' => [ + [ + 'line' => 11, + 'column' => 17, + ], + ], + 'path' => [ 'updateThemeMods' ] + ] + ], + 'data' => [ + 'updateThemeMods' => null + ], + ]; + /** + * use --debug flag to view + */ + \Codeception\Util\Debug::debug( $actual ); + + /** + * Compare the actual output vs the expected output + */ + $this->assertEquals( $expected, $actual ); + + } + +} \ No newline at end of file diff --git a/tests/wpunit/ThemeModsQueriesTest.php b/tests/wpunit/ThemeModsQueriesTest.php new file mode 100644 index 000000000..597647bf9 --- /dev/null +++ b/tests/wpunit/ThemeModsQueriesTest.php @@ -0,0 +1,170 @@ +author = $this->factory()->user->create( [ + 'role' => 'author', + ] ); + $this->admin = $this->factory()->user->create( [ + 'role' => 'administrator', + ] ); + $this->subscriber = $this->factory()->user->create( [ + 'role' => 'subscriber', + ] ); + $this->logo_id = $this->createPostObject( [ + 'post_type' => 'attachment', + 'post_content' => '

some description

', + ] ); + $this->custom_css_post_id = $this->createPostObject( [ + 'post_type' => 'post', + 'post_content' => '

some css

', + ] ); + $this->nav_menu_id = wp_create_nav_menu( 'My Menu' ); + add_theme_support( 'custom-background' ); + register_nav_menu( 'my-menu-location', 'My Menu Location' ); + + set_theme_mod( 'background_color', 'd4d4d4' ); + set_theme_mod( 'custom_logo', $this->logo_id ); + set_theme_mod( 'custom_css_post_id', $this->custom_css_post_id ); + set_theme_mod( 'nav_menu_locations', [ 'my-menu-location' => $this->nav_menu_id ] ); + + } + + public function tearDown() { + // your tear down methods here + + // then + parent::tearDown(); + } + + public function createPostObject( $args ) { + + /** + * Set up the $defaults + */ + $defaults = [ + 'post_author' => $this->admin, + 'post_content' => 'Test page content', + 'post_excerpt' => 'Test excerpt', + 'post_status' => 'publish', + 'post_title' => 'Test Title', + 'post_type' => 'post', + 'post_date' => $this->current_date, + ]; + + /** + * Combine the defaults with the $args that were + * passed through + */ + $args = array_merge( $defaults, $args ); + + /** + * Create the page + */ + $post_id = $this->factory->post->create( $args ); + + /** + * Update the _edit_last and _edit_lock fields to simulate a user editing the page to + * test retrieving the fields + * + * @since 0.0.5 + */ + update_post_meta( $post_id, '_edit_lock', $this->current_time . ':' . $this->admin ); + update_post_meta( $post_id, '_edit_last', $this->admin ); + + /** + * Return the $id of the post_object that was created + */ + return $post_id; + + } + + // tests + public function testThemeModsQuery() + { + /** + * Test Query + */ + $query = ' + query themeModsQuery{ + themeMods { + background { + id + sourceUrl + } + backgroundColor + customCssPostId + customCss { + postId + content + } + customLogo { + mediaItemId + } + headerImage { + id + sourceUrl + } + navMenu(location: MY_MENU_LOCATION) { + menuId + name + } + } + } + '; + + $variables = [ + + ]; + + $actual = do_graphql_request( $query, 'themeModsQuery' ); + + $expected = [ + 'data' => [ + 'themeMods' => [ + 'background' => null, + 'backgroundColor' => 'd4d4d4', + 'customLogo' => [ + 'mediaItemId' => $this->logo_id, + ], + 'customCssPostId' => $this->custom_css_post_id, + 'customCss' => [ + 'postId' => $this->custom_css_post_id, + 'content' => '

some css

+', + ], + 'headerImage' => null, + 'navMenu' => [ + 'menuId' => $this->nav_menu_id, + 'name' => 'My Menu', + ] + ], + ] + ]; + + /** + * use --debug flag to view + */ + \Codeception\Util\Debug::debug( $actual ); + + /** + * Compare the actual output vs the expected output + */ + $this->assertEquals( $expected, $actual ); + + } + +} \ No newline at end of file diff --git a/vendor/autoload.php b/vendor/autoload.php index c394f24f1..63d329a42 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit66c4826911a72a5b725e04123579db72::getLoader(); +return ComposerAutoloaderIniteef009e4ce4102fcdc64a4f254aad1bd::getLoader(); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 95f7e0978..fce8549f0 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -279,7 +279,7 @@ public function isClassMapAuthoritative() */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index 62ecfd8d0..f27399a04 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,3 +1,4 @@ + Copyright (c) Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy @@ -17,3 +18,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 33db3957d..22693508c 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -201,6 +201,7 @@ 'WPGraphQL\\Data\\TermObjectConnectionResolver' => $baseDir . '/src/Data/TermObjectConnectionResolver.php', 'WPGraphQL\\Data\\TermObjectMutation' => $baseDir . '/src/Data/TermObjectMutation.php', 'WPGraphQL\\Data\\ThemeConnectionResolver' => $baseDir . '/src/Data/ThemeConnectionResolver.php', + 'WPGraphQL\\Data\\ThemeModsMutation' => $baseDir . '/src/Data/ThemeModsMutation.php', 'WPGraphQL\\Data\\UserConnectionResolver' => $baseDir . '/src/Data/UserConnectionResolver.php', 'WPGraphQL\\Data\\UserMutation' => $baseDir . '/src/Data/UserMutation.php', 'WPGraphQL\\Data\\UserRoleConnectionResolver' => $baseDir . '/src/Data/UserRoleConnectionResolver.php', @@ -218,6 +219,7 @@ 'WPGraphQL\\Mutation\\TermObjectDelete' => $baseDir . '/src/Mutation/TermObjectDelete.php', 'WPGraphQL\\Mutation\\TermObjectUpdate' => $baseDir . '/src/Mutation/TermObjectUpdate.php', 'WPGraphQL\\Mutation\\UpdateSettings' => $baseDir . '/src/Mutation/UpdateSettings.php', + 'WPGraphQL\\Mutation\\UpdateThemeMods' => $baseDir . '/src/Mutation/UpdateThemeMods.php', 'WPGraphQL\\Mutation\\UserCreate' => $baseDir . '/src/Mutation/UserCreate.php', 'WPGraphQL\\Mutation\\UserDelete' => $baseDir . '/src/Mutation/UserDelete.php', 'WPGraphQL\\Mutation\\UserRegister' => $baseDir . '/src/Mutation/UserRegister.php', diff --git a/vendor/composer/autoload_commands_classmap.php b/vendor/composer/autoload_commands_classmap.php deleted file mode 100644 index 981d2b363..000000000 --- a/vendor/composer/autoload_commands_classmap.php +++ /dev/null @@ -1,9 +0,0 @@ -addClassMap($classMap); - } - $loader->register(true); - - return $loader; - } -} diff --git a/vendor/composer/autoload_framework_classmap.php b/vendor/composer/autoload_framework_classmap.php deleted file mode 100644 index 8d672d7ae..000000000 --- a/vendor/composer/autoload_framework_classmap.php +++ /dev/null @@ -1,235 +0,0 @@ - $vendorDir . '/ivome/graphql-relay-php/src/Connection/ArrayConnection.php', - 'GraphQLRelay\\Connection\\Connection' => $vendorDir . '/ivome/graphql-relay-php/src/Connection/Connection.php', - 'GraphQLRelay\\Mutation\\Mutation' => $vendorDir . '/ivome/graphql-relay-php/src/Mutation/Mutation.php', - 'GraphQLRelay\\Node\\Node' => $vendorDir . '/ivome/graphql-relay-php/src/Node/Node.php', - 'GraphQLRelay\\Node\\Plural' => $vendorDir . '/ivome/graphql-relay-php/src/Node/Plural.php', - 'GraphQLRelay\\Relay' => $vendorDir . '/ivome/graphql-relay-php/src/Relay.php', - 'GraphQL\\Deferred' => $vendorDir . '/webonyx/graphql-php/src/Deferred.php', - 'GraphQL\\Error' => $vendorDir . '/webonyx/graphql-php/src/Error.php', - 'GraphQL\\Error\\ClientAware' => $vendorDir . '/webonyx/graphql-php/src/Error/ClientAware.php', - 'GraphQL\\Error\\Debug' => $vendorDir . '/webonyx/graphql-php/src/Error/Debug.php', - 'GraphQL\\Error\\Error' => $vendorDir . '/webonyx/graphql-php/src/Error/Error.php', - 'GraphQL\\Error\\FormattedError' => $vendorDir . '/webonyx/graphql-php/src/Error/FormattedError.php', - 'GraphQL\\Error\\InvariantViolation' => $vendorDir . '/webonyx/graphql-php/src/Error/InvariantViolation.php', - 'GraphQL\\Error\\SyntaxError' => $vendorDir . '/webonyx/graphql-php/src/Error/SyntaxError.php', - 'GraphQL\\Error\\UserError' => $vendorDir . '/webonyx/graphql-php/src/Error/UserError.php', - 'GraphQL\\Error\\Warning' => $vendorDir . '/webonyx/graphql-php/src/Error/Warning.php', - 'GraphQL\\Executor\\ExecutionContext' => $vendorDir . '/webonyx/graphql-php/src/Executor/ExecutionContext.php', - 'GraphQL\\Executor\\ExecutionResult' => $vendorDir . '/webonyx/graphql-php/src/Executor/ExecutionResult.php', - 'GraphQL\\Executor\\Executor' => $vendorDir . '/webonyx/graphql-php/src/Executor/Executor.php', - 'GraphQL\\Executor\\Promise\\Adapter\\ReactPromiseAdapter' => $vendorDir . '/webonyx/graphql-php/src/Executor/Promise/Adapter/ReactPromiseAdapter.php', - 'GraphQL\\Executor\\Promise\\Adapter\\SyncPromise' => $vendorDir . '/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php', - 'GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter' => $vendorDir . '/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromiseAdapter.php', - 'GraphQL\\Executor\\Promise\\Promise' => $vendorDir . '/webonyx/graphql-php/src/Executor/Promise/Promise.php', - 'GraphQL\\Executor\\Promise\\PromiseAdapter' => $vendorDir . '/webonyx/graphql-php/src/Executor/Promise/PromiseAdapter.php', - 'GraphQL\\Executor\\Values' => $vendorDir . '/webonyx/graphql-php/src/Executor/Values.php', - 'GraphQL\\GraphQL' => $vendorDir . '/webonyx/graphql-php/src/GraphQL.php', - 'GraphQL\\Language\\AST\\ArgumentNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/ArgumentNode.php', - 'GraphQL\\Language\\AST\\BooleanValueNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/BooleanValueNode.php', - 'GraphQL\\Language\\AST\\DefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/DefinitionNode.php', - 'GraphQL\\Language\\AST\\DirectiveDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/DirectiveDefinitionNode.php', - 'GraphQL\\Language\\AST\\DirectiveNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/DirectiveNode.php', - 'GraphQL\\Language\\AST\\DocumentNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/DocumentNode.php', - 'GraphQL\\Language\\AST\\EnumTypeDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/EnumTypeDefinitionNode.php', - 'GraphQL\\Language\\AST\\EnumValueDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/EnumValueDefinitionNode.php', - 'GraphQL\\Language\\AST\\EnumValueNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/EnumValueNode.php', - 'GraphQL\\Language\\AST\\FieldDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/FieldDefinitionNode.php', - 'GraphQL\\Language\\AST\\FieldNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/FieldNode.php', - 'GraphQL\\Language\\AST\\FloatValueNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/FloatValueNode.php', - 'GraphQL\\Language\\AST\\FragmentDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/FragmentDefinitionNode.php', - 'GraphQL\\Language\\AST\\FragmentSpreadNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/FragmentSpreadNode.php', - 'GraphQL\\Language\\AST\\HasSelectionSet' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/HasSelectionSet.php', - 'GraphQL\\Language\\AST\\InlineFragmentNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/InlineFragmentNode.php', - 'GraphQL\\Language\\AST\\InputObjectTypeDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/InputObjectTypeDefinitionNode.php', - 'GraphQL\\Language\\AST\\InputValueDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/InputValueDefinitionNode.php', - 'GraphQL\\Language\\AST\\IntValueNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/IntValueNode.php', - 'GraphQL\\Language\\AST\\InterfaceTypeDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/InterfaceTypeDefinitionNode.php', - 'GraphQL\\Language\\AST\\ListTypeNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/ListTypeNode.php', - 'GraphQL\\Language\\AST\\ListValueNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/ListValueNode.php', - 'GraphQL\\Language\\AST\\Location' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/Location.php', - 'GraphQL\\Language\\AST\\NameNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/NameNode.php', - 'GraphQL\\Language\\AST\\NamedTypeNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/NamedTypeNode.php', - 'GraphQL\\Language\\AST\\Node' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/Node.php', - 'GraphQL\\Language\\AST\\NodeKind' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/NodeKind.php', - 'GraphQL\\Language\\AST\\NodeList' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/NodeList.php', - 'GraphQL\\Language\\AST\\NonNullTypeNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/NonNullTypeNode.php', - 'GraphQL\\Language\\AST\\NullValueNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/NullValueNode.php', - 'GraphQL\\Language\\AST\\ObjectFieldNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/ObjectFieldNode.php', - 'GraphQL\\Language\\AST\\ObjectTypeDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/ObjectTypeDefinitionNode.php', - 'GraphQL\\Language\\AST\\ObjectValueNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/ObjectValueNode.php', - 'GraphQL\\Language\\AST\\OperationDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/OperationDefinitionNode.php', - 'GraphQL\\Language\\AST\\OperationTypeDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/OperationTypeDefinitionNode.php', - 'GraphQL\\Language\\AST\\ScalarTypeDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/ScalarTypeDefinitionNode.php', - 'GraphQL\\Language\\AST\\SchemaDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/SchemaDefinitionNode.php', - 'GraphQL\\Language\\AST\\SelectionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/SelectionNode.php', - 'GraphQL\\Language\\AST\\SelectionSetNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/SelectionSetNode.php', - 'GraphQL\\Language\\AST\\StringValueNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/StringValueNode.php', - 'GraphQL\\Language\\AST\\TypeDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/TypeDefinitionNode.php', - 'GraphQL\\Language\\AST\\TypeExtensionDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/TypeExtensionDefinitionNode.php', - 'GraphQL\\Language\\AST\\TypeNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/TypeNode.php', - 'GraphQL\\Language\\AST\\TypeSystemDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/TypeSystemDefinitionNode.php', - 'GraphQL\\Language\\AST\\UnionTypeDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/UnionTypeDefinitionNode.php', - 'GraphQL\\Language\\AST\\ValueNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/ValueNode.php', - 'GraphQL\\Language\\AST\\VariableDefinitionNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/VariableDefinitionNode.php', - 'GraphQL\\Language\\AST\\VariableNode' => $vendorDir . '/webonyx/graphql-php/src/Language/AST/VariableNode.php', - 'GraphQL\\Language\\Lexer' => $vendorDir . '/webonyx/graphql-php/src/Language/Lexer.php', - 'GraphQL\\Language\\Parser' => $vendorDir . '/webonyx/graphql-php/src/Language/Parser.php', - 'GraphQL\\Language\\Printer' => $vendorDir . '/webonyx/graphql-php/src/Language/Printer.php', - 'GraphQL\\Language\\Source' => $vendorDir . '/webonyx/graphql-php/src/Language/Source.php', - 'GraphQL\\Language\\SourceLocation' => $vendorDir . '/webonyx/graphql-php/src/Language/SourceLocation.php', - 'GraphQL\\Language\\Token' => $vendorDir . '/webonyx/graphql-php/src/Language/Token.php', - 'GraphQL\\Language\\Visitor' => $vendorDir . '/webonyx/graphql-php/src/Language/Visitor.php', - 'GraphQL\\Language\\VisitorOperation' => $vendorDir . '/webonyx/graphql-php/src/Language/Visitor.php', - 'GraphQL\\Schema' => $vendorDir . '/webonyx/graphql-php/src/Schema.php', - 'GraphQL\\Server' => $vendorDir . '/webonyx/graphql-php/src/Server.php', - 'GraphQL\\Server\\Helper' => $vendorDir . '/webonyx/graphql-php/src/Server/Helper.php', - 'GraphQL\\Server\\OperationParams' => $vendorDir . '/webonyx/graphql-php/src/Server/OperationParams.php', - 'GraphQL\\Server\\RequestError' => $vendorDir . '/webonyx/graphql-php/src/Server/RequestError.php', - 'GraphQL\\Server\\ServerConfig' => $vendorDir . '/webonyx/graphql-php/src/Server/ServerConfig.php', - 'GraphQL\\Server\\StandardServer' => $vendorDir . '/webonyx/graphql-php/src/Server/StandardServer.php', - 'GraphQL\\Type\\Definition\\AbstractType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/AbstractType.php', - 'GraphQL\\Type\\Definition\\BooleanType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/BooleanType.php', - 'GraphQL\\Type\\Definition\\CompositeType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/CompositeType.php', - 'GraphQL\\Type\\Definition\\Config' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/Config.php', - 'GraphQL\\Type\\Definition\\CustomScalarType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/CustomScalarType.php', - 'GraphQL\\Type\\Definition\\Directive' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/Directive.php', - 'GraphQL\\Type\\Definition\\DirectiveLocation' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/DirectiveLocation.php', - 'GraphQL\\Type\\Definition\\EnumType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/EnumType.php', - 'GraphQL\\Type\\Definition\\EnumValueDefinition' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/EnumValueDefinition.php', - 'GraphQL\\Type\\Definition\\FieldArgument' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/FieldArgument.php', - 'GraphQL\\Type\\Definition\\FieldDefinition' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/FieldDefinition.php', - 'GraphQL\\Type\\Definition\\FloatType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/FloatType.php', - 'GraphQL\\Type\\Definition\\IDType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/IDType.php', - 'GraphQL\\Type\\Definition\\InputObjectField' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/InputObjectField.php', - 'GraphQL\\Type\\Definition\\InputObjectType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/InputObjectType.php', - 'GraphQL\\Type\\Definition\\InputType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/InputType.php', - 'GraphQL\\Type\\Definition\\IntType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/IntType.php', - 'GraphQL\\Type\\Definition\\InterfaceType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/InterfaceType.php', - 'GraphQL\\Type\\Definition\\LeafType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/LeafType.php', - 'GraphQL\\Type\\Definition\\ListOfType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/ListOfType.php', - 'GraphQL\\Type\\Definition\\NonNull' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/NonNull.php', - 'GraphQL\\Type\\Definition\\ObjectType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/ObjectType.php', - 'GraphQL\\Type\\Definition\\OutputType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/OutputType.php', - 'GraphQL\\Type\\Definition\\ResolveInfo' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/ResolveInfo.php', - 'GraphQL\\Type\\Definition\\ScalarType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/ScalarType.php', - 'GraphQL\\Type\\Definition\\StringType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/StringType.php', - 'GraphQL\\Type\\Definition\\Type' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/Type.php', - 'GraphQL\\Type\\Definition\\UnionType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/UnionType.php', - 'GraphQL\\Type\\Definition\\UnmodifiedType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/UnmodifiedType.php', - 'GraphQL\\Type\\Definition\\WrappingType' => $vendorDir . '/webonyx/graphql-php/src/Type/Definition/WrappingType.php', - 'GraphQL\\Type\\EagerResolution' => $vendorDir . '/webonyx/graphql-php/src/Type/EagerResolution.php', - 'GraphQL\\Type\\Introspection' => $vendorDir . '/webonyx/graphql-php/src/Type/Introspection.php', - 'GraphQL\\Type\\LazyResolution' => $vendorDir . '/webonyx/graphql-php/src/Type/LazyResolution.php', - 'GraphQL\\Type\\Resolution' => $vendorDir . '/webonyx/graphql-php/src/Type/Resolution.php', - 'GraphQL\\Type\\Schema' => $vendorDir . '/webonyx/graphql-php/src/Type/Schema.php', - 'GraphQL\\Type\\SchemaConfig' => $vendorDir . '/webonyx/graphql-php/src/Type/SchemaConfig.php', - 'GraphQL\\Type\\TypeKind' => $vendorDir . '/webonyx/graphql-php/src/Type/Introspection.php', - 'GraphQL\\Utils' => $vendorDir . '/webonyx/graphql-php/src/Utils.php', - 'GraphQL\\Utils\\AST' => $vendorDir . '/webonyx/graphql-php/src/Utils/AST.php', - 'GraphQL\\Utils\\BuildSchema' => $vendorDir . '/webonyx/graphql-php/src/Utils/BuildSchema.php', - 'GraphQL\\Utils\\FindBreakingChanges' => $vendorDir . '/webonyx/graphql-php/src/Utils/FindBreakingChanges.php', - 'GraphQL\\Utils\\MixedStore' => $vendorDir . '/webonyx/graphql-php/src/Utils/MixedStore.php', - 'GraphQL\\Utils\\PairSet' => $vendorDir . '/webonyx/graphql-php/src/Utils/PairSet.php', - 'GraphQL\\Utils\\SchemaPrinter' => $vendorDir . '/webonyx/graphql-php/src/Utils/SchemaPrinter.php', - 'GraphQL\\Utils\\TypeComparators' => $vendorDir . '/webonyx/graphql-php/src/Utils/TypeComparators.php', - 'GraphQL\\Utils\\TypeInfo' => $vendorDir . '/webonyx/graphql-php/src/Utils/TypeInfo.php', - 'GraphQL\\Utils\\Utils' => $vendorDir . '/webonyx/graphql-php/src/Utils/Utils.php', - 'GraphQL\\Validator\\DocumentValidator' => $vendorDir . '/webonyx/graphql-php/src/Validator/DocumentValidator.php', - 'GraphQL\\Validator\\Rules\\AbstractQuerySecurity' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/AbstractQuerySecurity.php', - 'GraphQL\\Validator\\Rules\\AbstractValidationRule' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/AbstractValidationRule.php', - 'GraphQL\\Validator\\Rules\\ArgumentsOfCorrectType' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/ArgumentsOfCorrectType.php', - 'GraphQL\\Validator\\Rules\\CustomValidationRule' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/CustomValidationRule.php', - 'GraphQL\\Validator\\Rules\\DefaultValuesOfCorrectType' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/DefaultValuesOfCorrectType.php', - 'GraphQL\\Validator\\Rules\\DisableIntrospection' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/DisableIntrospection.php', - 'GraphQL\\Validator\\Rules\\FieldsOnCorrectType' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/FieldsOnCorrectType.php', - 'GraphQL\\Validator\\Rules\\FragmentsOnCompositeTypes' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/FragmentsOnCompositeTypes.php', - 'GraphQL\\Validator\\Rules\\KnownArgumentNames' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/KnownArgumentNames.php', - 'GraphQL\\Validator\\Rules\\KnownDirectives' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/KnownDirectives.php', - 'GraphQL\\Validator\\Rules\\KnownFragmentNames' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/KnownFragmentNames.php', - 'GraphQL\\Validator\\Rules\\KnownTypeNames' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/KnownTypeNames.php', - 'GraphQL\\Validator\\Rules\\LoneAnonymousOperation' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/LoneAnonymousOperation.php', - 'GraphQL\\Validator\\Rules\\NoFragmentCycles' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/NoFragmentCycles.php', - 'GraphQL\\Validator\\Rules\\NoUndefinedVariables' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/NoUndefinedVariables.php', - 'GraphQL\\Validator\\Rules\\NoUnusedFragments' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/NoUnusedFragments.php', - 'GraphQL\\Validator\\Rules\\NoUnusedVariables' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/NoUnusedVariables.php', - 'GraphQL\\Validator\\Rules\\OverlappingFieldsCanBeMerged' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/OverlappingFieldsCanBeMerged.php', - 'GraphQL\\Validator\\Rules\\PossibleFragmentSpreads' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/PossibleFragmentSpreads.php', - 'GraphQL\\Validator\\Rules\\ProvidedNonNullArguments' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/ProvidedNonNullArguments.php', - 'GraphQL\\Validator\\Rules\\QueryComplexity' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/QueryComplexity.php', - 'GraphQL\\Validator\\Rules\\QueryDepth' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/QueryDepth.php', - 'GraphQL\\Validator\\Rules\\ScalarLeafs' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/ScalarLeafs.php', - 'GraphQL\\Validator\\Rules\\UniqueArgumentNames' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/UniqueArgumentNames.php', - 'GraphQL\\Validator\\Rules\\UniqueDirectivesPerLocation' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/UniqueDirectivesPerLocation.php', - 'GraphQL\\Validator\\Rules\\UniqueFragmentNames' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/UniqueFragmentNames.php', - 'GraphQL\\Validator\\Rules\\UniqueInputFieldNames' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/UniqueInputFieldNames.php', - 'GraphQL\\Validator\\Rules\\UniqueOperationNames' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/UniqueOperationNames.php', - 'GraphQL\\Validator\\Rules\\UniqueVariableNames' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/UniqueVariableNames.php', - 'GraphQL\\Validator\\Rules\\VariablesAreInputTypes' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/VariablesAreInputTypes.php', - 'GraphQL\\Validator\\Rules\\VariablesInAllowedPosition' => $vendorDir . '/webonyx/graphql-php/src/Validator/Rules/VariablesInAllowedPosition.php', - 'GraphQL\\Validator\\ValidationContext' => $vendorDir . '/webonyx/graphql-php/src/Validator/ValidationContext.php', - 'WPGraphQL\\AppContext' => $baseDir . '/src/AppContext.php', - 'WPGraphQL\\Connection\\Comments' => $baseDir . '/src/Connection/Comments.php', - 'WPGraphQL\\Connection\\MenuItems' => $baseDir . '/src/Connection/MenuItems.php', - 'WPGraphQL\\Connection\\Menus' => $baseDir . '/src/Connection/Menus.php', - 'WPGraphQL\\Connection\\Plugins' => $baseDir . '/src/Connection/Plugins.php', - 'WPGraphQL\\Connection\\PostObjects' => $baseDir . '/src/Connection/PostObjects.php', - 'WPGraphQL\\Connection\\TermObjects' => $baseDir . '/src/Connection/TermObjects.php', - 'WPGraphQL\\Connection\\Themes' => $baseDir . '/src/Connection/Themes.php', - 'WPGraphQL\\Connection\\UserRoles' => $baseDir . '/src/Connection/UserRoles.php', - 'WPGraphQL\\Connection\\Users' => $baseDir . '/src/Connection/Users.php', - 'WPGraphQL\\Data\\CommentConnectionResolver' => $baseDir . '/src/Data/CommentConnectionResolver.php', - 'WPGraphQL\\Data\\CommentMutation' => $baseDir . '/src/Data/CommentMutation.php', - 'WPGraphQL\\Data\\Config' => $baseDir . '/src/Data/Config.php', - 'WPGraphQL\\Data\\ConnectionResolver' => $baseDir . '/src/Data/ConnectionResolver.php', - 'WPGraphQL\\Data\\ConnectionResolverInterface' => $baseDir . '/src/Data/ConnectionResolverInterface.php', - 'WPGraphQL\\Data\\DataSource' => $baseDir . '/src/Data/DataSource.php', - 'WPGraphQL\\Data\\Loader' => $baseDir . '/src/Data/Loader.php', - 'WPGraphQL\\Data\\MediaItemMutation' => $baseDir . '/src/Data/MediaItemMutation.php', - 'WPGraphQL\\Data\\MenuConnectionResolver' => $baseDir . '/src/Data/MenuConnectionResolver.php', - 'WPGraphQL\\Data\\MenuItemConnectionResolver' => $baseDir . '/src/Data/MenuItemConnectionResolver.php', - 'WPGraphQL\\Data\\PluginConnectionResolver' => $baseDir . '/src/Data/PluginConnectionResolver.php', - 'WPGraphQL\\Data\\PostObjectConnectionResolver' => $baseDir . '/src/Data/PostObjectConnectionResolver.php', - 'WPGraphQL\\Data\\PostObjectMutation' => $baseDir . '/src/Data/PostObjectMutation.php', - 'WPGraphQL\\Data\\TermObjectConnectionResolver' => $baseDir . '/src/Data/TermObjectConnectionResolver.php', - 'WPGraphQL\\Data\\TermObjectMutation' => $baseDir . '/src/Data/TermObjectMutation.php', - 'WPGraphQL\\Data\\ThemeConnectionResolver' => $baseDir . '/src/Data/ThemeConnectionResolver.php', - 'WPGraphQL\\Data\\UserConnectionResolver' => $baseDir . '/src/Data/UserConnectionResolver.php', - 'WPGraphQL\\Data\\UserMutation' => $baseDir . '/src/Data/UserMutation.php', - 'WPGraphQL\\Data\\UserRoleConnectionResolver' => $baseDir . '/src/Data/UserRoleConnectionResolver.php', - 'WPGraphQL\\Mutation\\CommentCreate' => $baseDir . '/src/Mutation/CommentCreate.php', - 'WPGraphQL\\Mutation\\CommentDelete' => $baseDir . '/src/Mutation/CommentDelete.php', - 'WPGraphQL\\Mutation\\CommentRestore' => $baseDir . '/src/Mutation/CommentRestore.php', - 'WPGraphQL\\Mutation\\CommentUpdate' => $baseDir . '/src/Mutation/CommentUpdate.php', - 'WPGraphQL\\Mutation\\MediaItemCreate' => $baseDir . '/src/Mutation/MediaItemCreate.php', - 'WPGraphQL\\Mutation\\MediaItemDelete' => $baseDir . '/src/Mutation/MediaItemDelete.php', - 'WPGraphQL\\Mutation\\MediaItemUpdate' => $baseDir . '/src/Mutation/MediaItemUpdate.php', - 'WPGraphQL\\Mutation\\PostObjectCreate' => $baseDir . '/src/Mutation/PostObjectCreate.php', - 'WPGraphQL\\Mutation\\PostObjectDelete' => $baseDir . '/src/Mutation/PostObjectDelete.php', - 'WPGraphQL\\Mutation\\PostObjectUpdate' => $baseDir . '/src/Mutation/PostObjectUpdate.php', - 'WPGraphQL\\Mutation\\TermObjectCreate' => $baseDir . '/src/Mutation/TermObjectCreate.php', - 'WPGraphQL\\Mutation\\TermObjectDelete' => $baseDir . '/src/Mutation/TermObjectDelete.php', - 'WPGraphQL\\Mutation\\TermObjectUpdate' => $baseDir . '/src/Mutation/TermObjectUpdate.php', - 'WPGraphQL\\Mutation\\UpdateSettings' => $baseDir . '/src/Mutation/UpdateSettings.php', - 'WPGraphQL\\Mutation\\UserCreate' => $baseDir . '/src/Mutation/UserCreate.php', - 'WPGraphQL\\Mutation\\UserDelete' => $baseDir . '/src/Mutation/UserDelete.php', - 'WPGraphQL\\Mutation\\UserRegister' => $baseDir . '/src/Mutation/UserRegister.php', - 'WPGraphQL\\Mutation\\UserUpdate' => $baseDir . '/src/Mutation/UserUpdate.php', - 'WPGraphQL\\Router' => $baseDir . '/src/Router.php', - 'WPGraphQL\\SchemaRegistry' => $baseDir . '/src/SchemaRegistry.php', - 'WPGraphQL\\TypeRegistry' => $baseDir . '/src/TypeRegistry.php', - 'WPGraphQL\\Type\\WPEnumType' => $baseDir . '/src/Type/WPEnumType.php', - 'WPGraphQL\\Type\\WPInputObjectType' => $baseDir . '/src/Type/WPInputObjectType.php', - 'WPGraphQL\\Type\\WPObjectType' => $baseDir . '/src/Type/WPObjectType.php', - 'WPGraphQL\\Type\\WPUnionType' => $baseDir . '/src/Type/WPUnionType.php', - 'WPGraphQL\\Types' => $baseDir . '/src/Types.php', - 'WPGraphQL\\Utils\\InstrumentSchema' => $baseDir . '/src/Utils/InstrumentSchema.php', - 'WPGraphQL\\WPSchema' => $baseDir . '/src/WPSchema.php', -); diff --git a/vendor/composer/autoload_framework_real.php b/vendor/composer/autoload_framework_real.php deleted file mode 100644 index 0ec3a831a..000000000 --- a/vendor/composer/autoload_framework_real.php +++ /dev/null @@ -1,34 +0,0 @@ -addClassMap($classMap); - } - $loader->register(true); - - return $loader; - } -} diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 32fd8cc67..04f516b96 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit66c4826911a72a5b725e04123579db72 +class ComposerAutoloaderIniteef009e4ce4102fcdc64a4f254aad1bd { private static $loader; @@ -19,15 +19,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit66c4826911a72a5b725e04123579db72', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderIniteef009e4ce4102fcdc64a4f254aad1bd', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit66c4826911a72a5b725e04123579db72', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderIniteef009e4ce4102fcdc64a4f254aad1bd', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit66c4826911a72a5b725e04123579db72::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticIniteef009e4ce4102fcdc64a4f254aad1bd::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ public static function getLoader() $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit66c4826911a72a5b725e04123579db72::$files; + $includeFiles = Composer\Autoload\ComposerStaticIniteef009e4ce4102fcdc64a4f254aad1bd::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire66c4826911a72a5b725e04123579db72($fileIdentifier, $file); + composerRequireeef009e4ce4102fcdc64a4f254aad1bd($fileIdentifier, $file); } return $loader; } } -function composerRequire66c4826911a72a5b725e04123579db72($fileIdentifier, $file) +function composerRequireeef009e4ce4102fcdc64a4f254aad1bd($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index a54760da1..89611cb00 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit66c4826911a72a5b725e04123579db72 +class ComposerStaticIniteef009e4ce4102fcdc64a4f254aad1bd { public static $files = array ( 'c594688b3441835d5575f3085da4a242' => __DIR__ . '/..' . '/webonyx/graphql-php/src/deprecated.php', @@ -228,6 +228,7 @@ class ComposerStaticInit66c4826911a72a5b725e04123579db72 'WPGraphQL\\Data\\TermObjectConnectionResolver' => __DIR__ . '/../..' . '/src/Data/TermObjectConnectionResolver.php', 'WPGraphQL\\Data\\TermObjectMutation' => __DIR__ . '/../..' . '/src/Data/TermObjectMutation.php', 'WPGraphQL\\Data\\ThemeConnectionResolver' => __DIR__ . '/../..' . '/src/Data/ThemeConnectionResolver.php', + 'WPGraphQL\\Data\\ThemeModsMutation' => __DIR__ . '/../..' . '/src/Data/ThemeModsMutation.php', 'WPGraphQL\\Data\\UserConnectionResolver' => __DIR__ . '/../..' . '/src/Data/UserConnectionResolver.php', 'WPGraphQL\\Data\\UserMutation' => __DIR__ . '/../..' . '/src/Data/UserMutation.php', 'WPGraphQL\\Data\\UserRoleConnectionResolver' => __DIR__ . '/../..' . '/src/Data/UserRoleConnectionResolver.php', @@ -245,6 +246,7 @@ class ComposerStaticInit66c4826911a72a5b725e04123579db72 'WPGraphQL\\Mutation\\TermObjectDelete' => __DIR__ . '/../..' . '/src/Mutation/TermObjectDelete.php', 'WPGraphQL\\Mutation\\TermObjectUpdate' => __DIR__ . '/../..' . '/src/Mutation/TermObjectUpdate.php', 'WPGraphQL\\Mutation\\UpdateSettings' => __DIR__ . '/../..' . '/src/Mutation/UpdateSettings.php', + 'WPGraphQL\\Mutation\\UpdateThemeMods' => __DIR__ . '/../..' . '/src/Mutation/UpdateThemeMods.php', 'WPGraphQL\\Mutation\\UserCreate' => __DIR__ . '/../..' . '/src/Mutation/UserCreate.php', 'WPGraphQL\\Mutation\\UserDelete' => __DIR__ . '/../..' . '/src/Mutation/UserDelete.php', 'WPGraphQL\\Mutation\\UserRegister' => __DIR__ . '/../..' . '/src/Mutation/UserRegister.php', @@ -264,9 +266,9 @@ class ComposerStaticInit66c4826911a72a5b725e04123579db72 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit66c4826911a72a5b725e04123579db72::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit66c4826911a72a5b725e04123579db72::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit66c4826911a72a5b725e04123579db72::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticIniteef009e4ce4102fcdc64a4f254aad1bd::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticIniteef009e4ce4102fcdc64a4f254aad1bd::$prefixDirsPsr4; + $loader->classMap = ComposerStaticIniteef009e4ce4102fcdc64a4f254aad1bd::$classMap; }, null, ClassLoader::class); }