public function testCategoryCreate()
 {
     $this->testReindexAll();
     $categories = $this->getCategories(4);
     $products = $this->getProducts(3);
     /** @var Category $categorySecond */
     $categorySecond = $categories[1];
     $categorySecond->setIsAnchor(0);
     $categorySecond->save();
     /** @var Category $categoryFifth */
     $categoryFifth = end($categories);
     /** @var Category $categorySixth */
     $categorySixth = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Category');
     $categorySixth->setName('Category 6')->setPath($categoryFifth->getPath())->setAvailableSortBy('name')->setDefaultSortBy('name')->setIsActive(true)->save();
     /** @var \Magento\Catalog\Model\Product $productThird */
     $productThird = end($products);
     $productThird->setCategoryIds([$categorySixth->getId()]);
     $productThird->save();
     $categories = [self::DEFAULT_ROOT_CATEGORY, $categorySixth->getId(), $categoryFifth->getId()];
     foreach ($categories as $categoryId) {
         $this->assertTrue((bool) $this->productResource->canBeShowInCategory($productThird, $categoryId));
     }
     $categories = [$categorySecond->getId()];
     foreach ($categories as $categoryId) {
         $this->assertFalse((bool) $this->productResource->canBeShowInCategory($productThird, $categoryId));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function canBeShowInCategory($product, $categoryId)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'canBeShowInCategory');
     if (!$pluginInfo) {
         return parent::canBeShowInCategory($product, $categoryId);
     } else {
         return $this->___callPlugins('canBeShowInCategory', func_get_args(), $pluginInfo);
     }
 }