Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderBuilder fails after CartBuilder #88

Open
tim-bezhashvyly opened this issue Apr 23, 2023 · 0 comments
Open

OrderBuilder fails after CartBuilder #88

tim-bezhashvyly opened this issue Apr 23, 2023 · 0 comments
Labels

Comments

@tim-bezhashvyly
Copy link
Contributor

tim-bezhashvyly commented Apr 23, 2023

If I'm using an order builder right after the cart builder I'm getting the following error:

Magento\Framework\Validator\Exception : Please check the shipping address information. Provided customer ID "0" isn't related to current customer address.
 /path/to/vendor/magento/module-quote/Model/QuoteValidator.php:109
 /path/to/vendor/magento/module-quote/Model/SubmitQuoteValidator.php:52
 /path/to/vendor/magento/module-quote/Model/QuoteManagement.php:529
 /path/to/vendor/magento/module-quote/Model/QuoteManagement.php:483
 /path/to/vendor/magento/framework/Interception/Interceptor.php:58
 /path/to/vendor/magento/framework/Interception/Interceptor.php:138
 /path/to/vendor/magento/module-sales-rule/Plugin/CouponUsagesIncrement.php:54
 /path/to/vendor/magento/framework/Interception/Interceptor.php:135
 /path/to/vendor/magento/framework/Interception/Interceptor.php:153
 /path/to/generated/code/Magento/Quote/Model/QuoteManagement/Interceptor.php:32
 /path/to/vendor/tddwizard/magento2-fixtures/src/Checkout/CustomerCheckout.php:173
 /path/to/vendor/tddwizard/magento2-fixtures/src/Sales/OrderBuilder.php:146
 /path/to/app/code/Aescripts/RequiredPurchase/Test/Integration/Observer/DummyTest.php:16

Here is the reproducible code minimum:

<?php

declare(strict_types=1);

namespace Vendor\Module\Test\Integration\Observer;

use PHPUnit\Framework\TestCase;
use TddWizard\Fixtures\Checkout\CartBuilder;
use TddWizard\Fixtures\Sales\OrderBuilder;

class DummyTest extends TestCase
{
    public function testOrderCreation(): void
    {
        CartBuilder::forCurrentSession()->build();
        OrderBuilder::anOrder()->build();
    }
}

The execution command is following:

/opt/homebrew/Cellar/php/8.2.4/bin/php /path/to/vendor/phpunit/phpunit/phpunit --configuration /path/to/dev/tests/integration/phpunit.xml --filter Vendor\Module\Test\Integration\Observer\DummyTest --test-suffix DummyTest.php /path/to/app/code/Aescripts/RequiredPurchase/Test/Integration/Observer --teamcity

@schmengler schmengler added the bug label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants