|
@@ 138-153 (lines=16) @@
|
| 135 |
|
* |
| 136 |
|
* @return void |
| 137 |
|
*/ |
| 138 |
|
public function testCreateProductCategoryRelationWithChildCategoryAndSettingEnabled() |
| 139 |
|
{ |
| 140 |
|
|
| 141 |
|
// initialize method arguments |
| 142 |
|
$generateCategoryProductRewrites = true; |
| 143 |
|
$productCategoryIds = ['2']; |
| 144 |
|
$category = [ |
| 145 |
|
'entity_id' => '10', |
| 146 |
|
'is_anchor' => '0' |
| 147 |
|
]; |
| 148 |
|
|
| 149 |
|
// create and invoke the partially mocked observer |
| 150 |
|
$productCategoryIds = $this->createAndInvokeObserver($generateCategoryProductRewrites, $productCategoryIds, $category); |
| 151 |
|
|
| 152 |
|
// assert that all categories have been processed |
| 153 |
|
$this->assertSame($productCategoryIds, ['2', '10']); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
/** |
|
@@ 162-177 (lines=16) @@
|
| 159 |
|
* |
| 160 |
|
* @return void |
| 161 |
|
*/ |
| 162 |
|
public function testCreateProductCategoryRelationWithChildCategoryAndSettingDisabled() |
| 163 |
|
{ |
| 164 |
|
|
| 165 |
|
// initialize method arguments |
| 166 |
|
$generateCategoryProductRewrites = false; |
| 167 |
|
$productCategoryIds = ['2']; |
| 168 |
|
$category = [ |
| 169 |
|
'entity_id' => '10', |
| 170 |
|
'is_anchor' => '0' |
| 171 |
|
]; |
| 172 |
|
|
| 173 |
|
// create and invoke the partially mocked observer |
| 174 |
|
$productCategoryIds = $this->createAndInvokeObserver($generateCategoryProductRewrites, $productCategoryIds, $category); |
| 175 |
|
|
| 176 |
|
// assert that only the root category ID has been processed |
| 177 |
|
$this->assertSame($productCategoryIds, ['2']); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
/** |