Skip to content
This repository has been archived by the owner. It is now read-only.

Fixed non existant category with products issue #311

Conversation

@ldusan84
Copy link
Contributor

@ldusan84 ldusan84 commented Jan 3, 2019

Description (*)

The category query for category that doesn't exist with products count shouldn't throw an error.

Fixed Issues (if relevant)

  1. #310: Non existent category with products query results in an error

Manual testing scenarios (*)

  1. Query:
{
  category(id: 99) {
    product_count
  }
}
  1. Result
{
  "data": {
    "category": null
  }
}

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
@magento-cicd2
Copy link
Contributor

@magento-cicd2 magento-cicd2 commented Jan 3, 2019

CLA assistant check
All committers have signed the CLA.

@@ -72,7 +72,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value

$rootCategoryId = $this->getCategoryId($args);
$categoriesTree = $this->categoryTree->getTree($info, $rootCategoryId);
if (!empty($categoriesTree)) {
if (!empty($categoriesTree) && ($categoriesTree->count() > 0)) {

This comment has been minimized.

@SikailoISM

SikailoISM Jan 15, 2019
Contributor

if (!empty($categoriesTree) && $categoriesTree->count()) {

QUERY;

$response = $this->graphQlQuery($query);
$expectedResponse = ['category' => null];

This comment has been minimized.

@naydav

naydav Feb 13, 2019
Contributor

It will be better to back some error like Category doesn't exist

Example for CMS page
https://github.com/magento/graphql-ce/blob/2.3-develop/app/code/Magento/CmsGraphQl/Model/Resolver/Page.php#L77

Thanks

This comment has been minimized.

@ldusan84

ldusan84 Feb 15, 2019
Author Contributor

@naydav that's done.

@ldusan84 ldusan84 force-pushed the ldusan84:feature/category-with-products-fix branch from 8b4f751 to 996ba90 Feb 15, 2019
@naydav naydav added the bug label Feb 20, 2019
@magento-engcom-team magento-engcom-team merged commit 996ba90 into magento:2.3-develop Mar 13, 2019
3 checks passed
3 checks passed
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
Travis CI - Pull Request Build Passed
Details
licence/cla Contributor License Agreement is signed.
Details
@contribution-survey
Copy link

@contribution-survey contribution-survey bot commented Mar 13, 2019

Hi @ldusan84, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

magento-engcom-team pushed a commit that referenced this pull request Mar 13, 2019
@naydav naydav removed this from the Release: 2.3.2 milestone Apr 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants