Skip to content

Commit

Permalink
Merge pull request #150 from jasonbahl/feature/#147-change-postTags
Browse files Browse the repository at this point in the history
#147 - Change postTags to tags
  • Loading branch information
jasonbahl committed Jun 15, 2017
2 parents ca51749 + bd9d42a commit 57a3a81
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions tests/test-post-object-queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ public function testPostQueryWithTags() {
query {
post(id: \"{$global_id}\") {
id
postTags {
tags {
edges {
node {
postTagId
tagId
name
}
}
Expand All @@ -376,11 +376,11 @@ public function testPostQueryWithTags() {
'data' => [
'post' => [
'id' => $global_id,
'postTags' => [
'tags' => [
'edges' => [
[
'node' => [
'postTagId' => $tag_id,
'tagId' => $tag_id,
'name' => 'A tag',
],
],
Expand Down
32 changes: 16 additions & 16 deletions tests/test-post-type-object-queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function testPostTypeQueryForPosts() {
menuIcon
menuPosition
name
postTags {
tags {
edges {
node {
name
Expand Down Expand Up @@ -187,7 +187,7 @@ public function testPostTypeQueryForPosts() {
'menuIcon' => null,
'menuPosition' => 5,
'name' => 'post',
'postTags' => [
'tags' => [
'edges' => [],
],
'public' => true,
Expand Down Expand Up @@ -236,10 +236,10 @@ public function testPostTypeQueryForPostConnections() {
query {
posts {
postTypeInfo {
postTags {
tags {
edges {
node {
postTagId
tagId
name
}
}
Expand Down Expand Up @@ -268,11 +268,11 @@ public function testPostTypeQueryForPostConnections() {
'data' => [
'posts' => [
'postTypeInfo' => [
'postTags' => [
'tags' => [
'edges' => [
[
'node' => [
'postTagId' => $tag_id,
'tagId' => $tag_id,
'name' => 'A tag',
],
],
Expand Down Expand Up @@ -340,7 +340,7 @@ public function testPostTypeQueryForPages() {
menuIcon
menuPosition
name
postTags {
tags {
edges {
node {
name
Expand Down Expand Up @@ -391,7 +391,7 @@ public function testPostTypeQueryForPages() {
'menuIcon' => null,
'menuPosition' => 20,
'name' => 'page',
'postTags' => [
'tags' => [
'edges' => [],
],
'public' => true,
Expand Down Expand Up @@ -440,10 +440,10 @@ public function testPostTypeQueryForPageConnections() {
query {
pages {
postTypeInfo {
postTags {
tags {
edges {
node {
postTagId
tagId
name
}
}
Expand Down Expand Up @@ -472,7 +472,7 @@ public function testPostTypeQueryForPageConnections() {
'data' => [
'pages' => [
'postTypeInfo' => [
'postTags' => [
'tags' => [
'edges' => [],
],
'categories' => [
Expand Down Expand Up @@ -530,7 +530,7 @@ public function testPostTypeQueryForMedia() {
menuIcon
menuPosition
name
postTags {
tags {
edges {
node {
name
Expand Down Expand Up @@ -581,7 +581,7 @@ public function testPostTypeQueryForMedia() {
'menuIcon' => null,
'menuPosition' => null,
'name' => 'attachment',
'postTags' => [
'tags' => [
'edges' => [],
],
'public' => true,
Expand Down Expand Up @@ -630,10 +630,10 @@ public function testPostTypeQueryForMediaConnections() {
query {
pages {
postTypeInfo {
postTags {
tags {
edges {
node {
postTagId
tagId
name
}
}
Expand Down Expand Up @@ -662,7 +662,7 @@ public function testPostTypeQueryForMediaConnections() {
'data' => [
'pages' => [
'postTypeInfo' => [
'postTags' => [
'tags' => [
'edges' => [],
],
'categories' => [
Expand Down
12 changes: 6 additions & 6 deletions tests/test-taxonomy-object-queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function testTaxonomyQueryForTags() {
*/
$query = "
query {
postTags {
tags {
taxonomyInfo {
connectedPostTypeNames
connectedPostTypes {
Expand Down Expand Up @@ -185,13 +185,13 @@ public function testTaxonomyQueryForTags() {
*/
$expected = [
'data' => [
'postTags' => [
'tags' => [
'taxonomyInfo' => [
'connectedPostTypeNames' => [ 'post' ],
'connectedPostTypes' => [ [ 'name' => 'post'] ],
'description' => '',
'graphqlPluralName' => 'postTags',
'graphqlSingleName' => 'postTag',
'graphqlPluralName' => 'tags',
'graphqlSingleName' => 'tag',
'hierarchical' => false,
'id' => $global_id,
'label' => 'Tags',
Expand Down Expand Up @@ -304,7 +304,7 @@ public function testTaxonomyQueryTagsConnections() {
*/
$query = "
query {
postTags {
tags {
taxonomyInfo {
name
posts {
Expand All @@ -330,7 +330,7 @@ public function testTaxonomyQueryTagsConnections() {
*/
$expected = [
'data' => [
'postTags' => [
'tags' => [
'taxonomyInfo' => [
'name' => 'post_tag',
'posts' => [
Expand Down
4 changes: 2 additions & 2 deletions wp-graphql.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ public static function show_in_graphql() {
// Adds GraphQL support for tags
if ( isset( $wp_taxonomies['post_tag'] ) ) {
$wp_taxonomies['post_tag']->show_in_graphql = true;
$wp_taxonomies['post_tag']->graphql_single_name = 'postTag';
$wp_taxonomies['post_tag']->graphql_plural_name = 'postTags';
$wp_taxonomies['post_tag']->graphql_single_name = 'tag';
$wp_taxonomies['post_tag']->graphql_plural_name = 'tags';
}
}

Expand Down

0 comments on commit 57a3a81

Please sign in to comment.