Skip to content

Commit

Permalink
#17 Fixing php55 fatal error.
Browse files Browse the repository at this point in the history
  • Loading branch information
hughdevore committed Aug 11, 2017
1 parent f48b55d commit 6a1fd48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Type/MediaItem/Mutation/MediaItemCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function mutate( \WP_Post_Type $post_type_object ) {
* Stop now if a user isn't allowed to upload a mediaItem
*/
if ( ! current_user_can( 'upload_files' ) ) {
return new \Exception( __( 'Sorry, you are not allowed to upload mediaItems', 'wp-graphql' ) );
throw new \Exception( __( 'Sorry, you are not allowed to upload mediaItems', 'wp-graphql' ) );
}

/**
Expand Down
7 changes: 7 additions & 0 deletions tests/test-media-item-mutations.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public function testCreateMediaItemMutation() {
createMediaItem(input: $input){
clientMutationId
mediaItem{
id
mediaItemId
date
dateGmt
slug
Expand Down Expand Up @@ -199,11 +201,16 @@ public function testCreateMediaItemMutation() {
*/
$actual = do_graphql_request( $mutation, 'createMediaItem', $variables );

$media_item_id = $actual["data"]["createMediaItem"]["mediaItem"]["id"];
$attachment_id = $actual["data"]["createMediaItem"]["mediaItem"]["mediaItemId"];

$expected = [
'data' => [
'createMediaItem' => [
'clientMutationId' => $this->clientMutationId,
'mediaItem' => [
'id' => $media_item_id,
'mediaItemId' => $attachment_id,
'title' => $this->title,
'description' => apply_filters( 'the_content', $this->description ),
'altText' => $this->altText,
Expand Down

0 comments on commit 6a1fd48

Please sign in to comment.