/** * @covers sCategories::sGetCategoriesByParent */ public function testsGetCategoriesByParent() { // Calling on subcategory return path $path = $this->module->sGetCategoriesByParent(21); $this->assertCount(2, $path); foreach ($path as $category) { $this->assertArrayHasKey('id', $category); $this->assertArrayHasKey('name', $category); $this->assertArrayHasKey('blog', $category); $this->assertArrayHasKey('link', $category); } // Calling on shop category return empty array $this->assertCount(0, $this->module->sGetCategoriesByParent(Shopware()->Shop()->get('parentID'))); // Assert root category $path = $this->module->sGetCategoriesByParent(1); $this->assertCount(1, $path); foreach ($path as $category) { $this->assertArrayHasKey('id', $category); $this->assertArrayHasKey('name', $category); $this->assertArrayHasKey('blog', $category); $this->assertArrayHasKey('link', $category); $this->assertEquals('Root', $category['name']); $this->assertEquals(1, $category['id']); } }