From 598668cac967506f120d7ed78673f1f8b476a604 Mon Sep 17 00:00:00 2001 From: hughdevore Date: Mon, 14 Aug 2017 15:12:23 -0600 Subject: [PATCH] #17 Adding unit tests. --- src/Type/MediaItem/Mutation/MediaItemUpdate.php | 2 +- tests/test-media-item-mutations.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Type/MediaItem/Mutation/MediaItemUpdate.php b/src/Type/MediaItem/Mutation/MediaItemUpdate.php index fd617b6a5..6d830f48e 100644 --- a/src/Type/MediaItem/Mutation/MediaItemUpdate.php +++ b/src/Type/MediaItem/Mutation/MediaItemUpdate.php @@ -53,7 +53,7 @@ public static function mutate( \WP_Post_Type $post_type_object ) { /** * If there's no existing mediaItem, throw an exception */ - if ( empty( $id_parts['id'] ) || false === $existing_media_item ) { + if ( empty( $id_parts['id'] ) || null === $existing_media_item ) { throw new \Exception( __( 'No mediaItems could be found to update', 'wp-graphql' ) ); } diff --git a/tests/test-media-item-mutations.php b/tests/test-media-item-mutations.php index c33b60eb1..9c94abbee 100644 --- a/tests/test-media-item-mutations.php +++ b/tests/test-media-item-mutations.php @@ -479,7 +479,7 @@ public function updateMediaItemMutation() { * @return void */ public function testUmiInvalidId() { - $this->update_variables['input']['id'] = 12345; + $this->update_variables['input']['id'] = '12345'; $actual = $this->updateMediaItemMutation(); $this->assertArrayHasKey( 'errors', $actual ); $variables['input']['id'] = $this->media_item_id;