/**
  * @covers sCategories::sGetCategoryIdByArticleId
  */
 public function testsGetCategoryIdByArticleId()
 {
     // Known value
     $this->assertEquals(21, $this->module->sGetCategoryIdByArticleId(2));
     // Check that searching in default category or with null is the same
     $this->assertEquals($this->module->sGetCategoryIdByArticleId(2, Shopware()->Shop()->get('parentID')), $this->module->sGetCategoryIdByArticleId(2));
     // Check that searching in different trees gives different results
     $this->assertNotEquals($this->module->sGetCategoryIdByArticleId(2, Shopware()->Shop()->get('parentID')), $this->module->sGetCategoryIdByArticleId(2, 39));
     // Check that searching in subtrees gives different the same results
     $this->assertEquals($this->module->sGetCategoryIdByArticleId(2, Shopware()->Shop()->get('parentID')), $this->module->sGetCategoryIdByArticleId(2, 10));
     // Check that searching for an article where it doesn't exist returns 0
     $this->assertEquals(0, $this->module->sGetCategoryIdByArticleId(75, 39));
 }
Example #2
0
 /**
  * @covers sCategories::sGetCategoryIdByArticleId
  */
 public function testsGetCategoryIdByArticleId()
 {
     //first category which assigned to the product 2
     $this->assertEquals(14, $this->module->sGetCategoryIdByArticleId(2));
     // Check that searching in default category or with null is the same
     $this->assertEquals($this->module->sGetCategoryIdByArticleId(2, Shopware()->Shop()->get('parentID')), $this->module->sGetCategoryIdByArticleId(2));
     // Check that searching in different trees gives different results
     $this->assertNotEquals($this->module->sGetCategoryIdByArticleId(2, Shopware()->Shop()->get('parentID')), $this->module->sGetCategoryIdByArticleId(2, 39));
     // provide own parent id to filter returned category id
     $this->assertEquals(21, $this->module->sGetCategoryIdByArticleId(2, 10));
     // Check that searching for an article where it doesn't exist returns 0
     $this->assertEquals(0, $this->module->sGetCategoryIdByArticleId(75, 39));
 }