forked from PrestaShop/PrestaShop
-
Notifications
You must be signed in to change notification settings - Fork 0
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 PrestaShop#23078 from Progi1984/issue22983
Fixed missing APE/SIRET Code in BackOffice Order View
- Loading branch information
Showing
8 changed files
with
232 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
87 changes: 87 additions & 0 deletions
87
tests/Integration/Behaviour/Features/Context/Domain/OrderCustomerFeatureContext.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,87 @@ | ||
<?php | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
namespace Tests\Integration\Behaviour\Features\Context\Domain; | ||
|
||
use PHPUnit\Framework\Assert as Assert; | ||
use PrestaShop\PrestaShop\Core\Domain\Order\Query\GetOrderForViewing; | ||
use PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderCustomerForViewing; | ||
use PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderForViewing; | ||
use Tests\Integration\Behaviour\Features\Context\SharedStorage; | ||
|
||
class OrderCustomerFeatureContext extends AbstractDomainFeatureContext | ||
{ | ||
/** | ||
* @Then /^the customer of the order "(.+)" has the APE Code "(.*)"$/ | ||
* | ||
* @param string $orderReference | ||
* @param string $ape | ||
*/ | ||
public function orderCustomerHasAPECode(string $orderReference, string $ape): void | ||
{ | ||
$orderId = SharedStorage::getStorage()->get($orderReference); | ||
/** @var OrderForViewing $orderForViewing */ | ||
$orderForViewing = $this->getQueryBus()->handle(new GetOrderForViewing($orderId)); | ||
/** @var OrderCustomerForViewing $orderCustomerForViewing */ | ||
$orderCustomerForViewing = $orderForViewing->getCustomer(); | ||
Assert::assertSame( | ||
$ape, | ||
$orderCustomerForViewing->getApe(), | ||
sprintf( | ||
'Expected customer with id "%d" has APE code "%s" but received "%s"', | ||
$orderCustomerForViewing->getId(), | ||
$orderCustomerForViewing->getApe(), | ||
$ape | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* @Then /^the customer of the order "(.+)" has the SIRET Code "(.*)"$/ | ||
* | ||
* @param string $orderReference | ||
* @param string $siret | ||
*/ | ||
public function orderCustomerHasSIRETCode(string $orderReference, string $siret): void | ||
{ | ||
$orderId = SharedStorage::getStorage()->get($orderReference); | ||
/** @var OrderForViewing $orderForViewing */ | ||
$orderForViewing = $this->getQueryBus()->handle(new GetOrderForViewing($orderId)); | ||
/** @var OrderCustomerForViewing $orderCustomerForViewing */ | ||
$orderCustomerForViewing = $orderForViewing->getCustomer(); | ||
|
||
Assert::assertSame( | ||
$siret, | ||
$orderCustomerForViewing->getSiret(), | ||
sprintf( | ||
'Expected customer with id "%d" has SIRET code "%s" but received "%s"', | ||
$orderCustomerForViewing->getId(), | ||
$orderCustomerForViewing->getSiret(), | ||
$siret | ||
) | ||
); | ||
} | ||
} |
Oops, something went wrong.