-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5585 from magento-tsg/2.4-develop-com-pr11
[TSG-Commerce] Tests for 2.4 (pr11)
- Loading branch information
Showing
33 changed files
with
2,585 additions
and
274 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...mework/Magento/TestFramework/Downloadable/Model/RemoveLinkPurchasedByOrderIncrementId.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\TestFramework\Downloadable\Model; | ||
|
||
use Magento\Downloadable\Model\ResourceModel\Link\Purchased as PurchasedResource; | ||
use Magento\Downloadable\Model\ResourceModel\Link\Purchased\CollectionFactory; | ||
|
||
/** | ||
* Delete records from downloadable_link_purchased associated with provided order | ||
*/ | ||
class RemoveLinkPurchasedByOrderIncrementId | ||
{ | ||
/** @var CollectionFactory */ | ||
private $linkCollectionFactory; | ||
|
||
/** @var PurchasedResource */ | ||
private $purchasedResource; | ||
|
||
/** | ||
* @param CollectionFactory $linkCollectionFactory | ||
* @param PurchasedResource $purchasedResource | ||
*/ | ||
public function __construct(CollectionFactory $linkCollectionFactory, PurchasedResource $purchasedResource) | ||
{ | ||
$this->linkCollectionFactory = $linkCollectionFactory; | ||
$this->purchasedResource = $purchasedResource; | ||
} | ||
|
||
/** | ||
* Remove records from downloadable_link_purchased related to provided order | ||
* | ||
* @param string $orderIncrementId | ||
* @return void | ||
*/ | ||
public function execute(string $orderIncrementId): void | ||
{ | ||
$collection = $this->linkCollectionFactory->create(); | ||
$collection->addFieldToFilter('order_increment_id', $orderIncrementId); | ||
foreach ($collection as $item) { | ||
$this->purchasedResource->delete($item); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.