@@ 107-122 (lines=16) @@ | ||
104 | return $property->getValue($observer); |
|
105 | } |
|
106 | ||
107 | public function testCreateProductCategoryRelationWithChildCategoryAndSettingEnabled() |
|
108 | { |
|
109 | ||
110 | // initialize method arguments |
|
111 | $generateCategoryProductRewrites = true; |
|
112 | $productCategoryIds = ['2']; |
|
113 | $category = [ |
|
114 | 'entity_id' => '10', |
|
115 | 'is_anchor' => '0' |
|
116 | ]; |
|
117 | ||
118 | // create and invoke the partially mocked observer |
|
119 | $productCategoryIds = $this->createAndInvokeObserver($generateCategoryProductRewrites, $productCategoryIds, $category); |
|
120 | ||
121 | $this->assertSame($productCategoryIds, ['2', '10']); |
|
122 | } |
|
123 | ||
124 | public function testCreateProductCategoryRelationWithChildCategoryAndSettingDisabled() |
|
125 | { |
|
@@ 124-139 (lines=16) @@ | ||
121 | $this->assertSame($productCategoryIds, ['2', '10']); |
|
122 | } |
|
123 | ||
124 | public function testCreateProductCategoryRelationWithChildCategoryAndSettingDisabled() |
|
125 | { |
|
126 | ||
127 | // initialize method arguments |
|
128 | $generateCategoryProductRewrites = false; |
|
129 | $productCategoryIds = ['2']; |
|
130 | $category = [ |
|
131 | 'entity_id' => '10', |
|
132 | 'is_anchor' => '0' |
|
133 | ]; |
|
134 | ||
135 | // create and invoke the partially mocked observer |
|
136 | $productCategoryIds = $this->createAndInvokeObserver($generateCategoryProductRewrites, $productCategoryIds, $category); |
|
137 | ||
138 | $this->assertSame($productCategoryIds, ['2']); |
|
139 | } |
|
140 | ||
141 | /** |
|
142 | * Test's the handle() method with a successful URL rewrite persist. |