Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/2.4-develop' into AC-106
Browse files Browse the repository at this point in the history
  • Loading branch information
Rrego6 committed Oct 28, 2021
2 parents 27833f3 + be9b1fe commit 350347f
Show file tree
Hide file tree
Showing 30 changed files with 579 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public function afterSave(
AbstractModel $group
) {
if (!$group->isObjectNew()
&& $group->getStoreIds()
&& ($group->dataHasChangedFor('website_id')
|| $group->dataHasChangedFor('root_category_id'))
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ protected function setUp(): void
->disableOriginalConstructor()
->setMethods(['isObjectNew', 'dataHasChangedFor', 'getStoreIds'])
->getMockForAbstractClass();
$this->abstractModelMock->expects($this->any())
->method('getStoreIds')
->willReturn([]);
$this->subjectMock = $this->getMockBuilder(Group::class)
->disableOriginalConstructor()
->getMock();
Expand Down Expand Up @@ -138,6 +135,9 @@ public function testAfterSave()
$this->abstractModelMock->expects($this->once())
->method('isObjectNew')
->willReturn(false);
$this->abstractModelMock->expects($this->any())
->method('getStoreIds')
->willReturn(['1']);
$this->abstractModelMock->expects($this->once())
->method('dataHasChangedFor')
->with('website_id')
Expand Down Expand Up @@ -165,10 +165,10 @@ public function testAfterSave()
$this->productCollectionMock->expects($this->once())
->method('addWebsiteFilter')
->willReturn($this->productCollectionMock);
$iterator = new \ArrayIterator([$this->productMock]);
$arrayIteratorMock = new \ArrayIterator([$this->productMock]);
$this->productCollectionMock->expects($this->once())
->method('getIterator')
->willReturn($iterator);
->willReturn($arrayIteratorMock);
$this->productUrlRewriteGeneratorMock->expects($this->once())
->method('generate')
->with($this->productMock)
Expand All @@ -179,4 +179,33 @@ public function testAfterSave()
$this->plugin->afterSave($this->subjectMock, $this->subjectMock, $this->abstractModelMock)
);
}

public function testAfterSaveWithNoStoresAssigned()
{
$this->abstractModelMock->expects($this->once())
->method('isObjectNew')
->willReturn(false);
$this->abstractModelMock->expects($this->any())
->method('getStoreIds')
->willReturn([]);
$this->abstractModelMock->expects($this->any())
->method('dataHasChangedFor')
->with('website_id')
->willReturn(true);
$this->storeManagerMock->expects($this->never())->method('reinitStores');
$this->categoryMock->expects($this->never())->method('getCategories');
$this->categoryFactoryMock->expects($this->never())->method('create');
$this->productFactoryMock->expects($this->never())->method('create');
$this->productMock->expects($this->never())->method('getCollection');
$this->productCollectionMock->expects($this->never())->method('addCategoryIds');
$this->productCollectionMock->expects($this->never()) ->method('addAttributeToSelect');
$this->productCollectionMock->expects($this->never())->method('addWebsiteFilter');
$this->productCollectionMock->expects($this->never())->method('getIterator');
$this->productUrlRewriteGeneratorMock->expects($this->never())->method('generate');

$this->assertSame(
$this->subjectMock,
$this->plugin->afterSave($this->subjectMock, $this->subjectMock, $this->abstractModelMock)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,18 @@
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrderButton"/>
<seeElement selector="{{CheckoutSuccessMainSection.success}}" stepKey="orderIsSuccessfullyPlaced"/>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
<actionGroup ref="StorefrontClickOrderLinkFromCheckoutSuccessPageActionGroup" stepKey="openOrderViewPage"/>
<grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/>

<!-- Login as admin -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

<!-- Open created order in backend -->
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrders"/>
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById">
<argument name="orderId" value="$grabOrderNumber"/>
<actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="filterOrdersGridById">
<argument name="entityId" value="$grabOrderId"/>
</actionGroup>

<comment userInput="Comment is added to preserve Backward Compatibility" stepKey="goToOrders"/>
<comment userInput="Comment is added to preserve Backward Compatibility" stepKey="filterOrderGridById"/>

<!-- Assert order total -->
<scrollTo selector="{{AdminOrderTotalSection.grandTotal}}" stepKey="scrollToOrderTotalSection"/>
<see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$565.00" stepKey="checkOrderTotalInBackend"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,20 @@
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCheckoutPaymentSectionPageLoad"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="orderIsSuccessfullyPlaced"/>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
<actionGroup ref="StorefrontClickOrderLinkFromCheckoutSuccessPageActionGroup" stepKey="openOrderViewPage"/>
<grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/>

<!-- Login as admin -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

<!--Step11. Go to admin Order page for newly created order-->
<actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openAdminOrderViewPage">
<argument name="entityId" value="$grabOrderId"/>
</actionGroup>

<!-- Open created order in backend -->
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrders"/>
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById">
<argument name="orderId" value="$grabOrderNumber"/>
</actionGroup>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToOrders"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterOrderGridById"/>

<!-- Assert order total -->
<scrollTo selector="{{AdminOrderTotalSection.grandTotal}}" stepKey="scrollToOrderTotalSection"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCheckoutPaymentSectionPageLoad"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="orderIsSuccessfullyPlaced"/>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
<actionGroup ref="StorefrontClickOrderLinkFromCheckoutSuccessPageActionGroup" stepKey="openOrderViewPage"/>
<grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/>

<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

<!-- Open created order in backend -->
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrders"/>
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById">
<argument name="orderId" value="$grabOrderNumber"/>
<actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="filterOrdersGridById">
<argument name="entityId" value="$grabOrderId"/>
</actionGroup>
<comment userInput="Comment is added to preserve Backward Compatibility" stepKey="goToOrders"/>
<comment userInput="Comment is added to preserve Backward Compatibility" stepKey="filterOrderGridById"/>

<!-- Assert order total -->
<scrollTo selector="{{AdminOrderTotalSection.grandTotal}}" stepKey="scrollToOrderTotalSection"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,19 @@
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrderButton"/>
<seeElement selector="{{CheckoutSuccessMainSection.success}}" stepKey="orderIsSuccessfullyPlaced"/>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
<actionGroup ref="StorefrontClickOrderLinkFromCheckoutSuccessPageActionGroup" stepKey="openOrderViewPage"/>
<grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/>

<!-- Login as admin -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

<!-- Open created order in backend -->
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrders"/>
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById">
<argument name="orderId" value="$grabOrderNumber"/>
<actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openAdminOrderViewPage">
<argument name="entityId" value="$grabOrderId"/>
</actionGroup>

<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToOrders"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterOrderGridById"/>
<!-- Assert that shipping and billing address are the same -->
<grabTextFrom selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" stepKey="shippingAddress"/>
<grabTextFrom selector="{{AdminShipmentAddressInformationSection.billingAddress}}" stepKey="billingAddress"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,19 @@
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrderButton"/>
<seeElement selector="{{CheckoutSuccessMainSection.success}}" stepKey="orderIsSuccessfullyPlaced" />
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
<actionGroup ref="StorefrontClickOrderLinkFromCheckoutSuccessPageActionGroup" stepKey="openOrderViewPage"/>
<grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/>

<!-- Login as admin -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

<!-- Open created order -->
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrders"/>
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrderGridById">
<argument name="orderId" value="$grabOrderNumber"/>
<actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openAdminOrderViewPage">
<argument name="entityId" value="$grabOrderId"/>
</actionGroup>

<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToOrders"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterOrderGridById"/>
<!-- Assert that addresses on order page the same -->
<grabTextFrom selector="{{AdminShipmentAddressInformationSection.shippingAddress}}" stepKey="shippingAddressOrderPage"/>
<grabTextFrom selector="{{AdminShipmentAddressInformationSection.billingAddress}}" stepKey="billingAddressOrderPage"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,16 @@
<!-- Place order and Assert success message -->
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"/>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="orderId"/>
<actionGroup ref="StorefrontClickOrderLinkFromCheckoutSuccessPageActionGroup" stepKey="openOrderViewPage"/>
<grabFromCurrentUrl regex="~/order_id/(\d+)/~" stepKey="grabOrderId"/>

<!-- Open Order Index Page -->
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrders"/>

<!-- Filter Order using orderId and assert order-->
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById">
<argument name="orderId" value="$orderId"/>
<actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openAdminOrderViewPage">
<argument name="entityId" value="$grabOrderId"/>
</actionGroup>

<click selector="{{AdminOrdersGridSection.viewLink('$orderId')}}" stepKey="clickOnViewLink"/>
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="goToOrders"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterOrderGridById"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="clickOnViewLink"/>
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForOrderPageToLoad"/>

<!-- Ship the order and assert the shipping status -->
<actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="shipTheOrder"/>
Expand Down
Loading

0 comments on commit 350347f

Please sign in to comment.