Closed bunyamin-gc closed 3 years ago
Hi @bunyamin-gc. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
@bunyamin-gc do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@magento give me 2.4-develop instance
Hi @bnymn. Thank you for your request. I'm working on Magento 2.4-develop instance for you
Hi @bnymn, here is your Magento instance.
Admin access: https://i-27864-2-4-develop.instances.magento-community.engineering/admin_7e68
Login: b9233226
Password: c16c3b542b9f
Instance will be terminated in up to 3 hours.
Hi @bunyamin-gc - do you know of any solution or workaround to that open issue yet?
I am trying to run integration tests for a extension refactoring but the installation process stops at step 4 and there is nothing I can do to fix the default website configuration currently. None of my configuration adaptions is being integrated for the test setup.
Exception: Starting Magento installation:
File permissions check...
[Progress: 1 / 1321]
Required extensions check...
[Progress: 2 / 1321]
Enabling Maintenance Mode...
[Progress: 3 / 1321]
Installing deployment configuration...
[Progress: 4 / 1321]
Installing database schema:
In WebsiteRepository.php line 159:
[DomainException]
The default website isn't defined. Set the website and try again.
Exception trace:
() at /var/www/src/vendor/magento/module-store/Model/WebsiteRepository.php:159
Magento\Store\Model\WebsiteRepository->getDefault() at /var/www/src/vendor/magento/module-store/Model/StoreResolver/Website.php:49
Magento\Store\Model\StoreResolver\Website->getAllowedStoreIds() at /var/www/src/vendor/magento/module-store/Model/StoresData.php:65
Magento\Store\Model\StoresData->getStoresData() at /var/www/src/vendor/magento/module-store/Model/StoreResolver.php:138
Does @magento-team know that integration tests are failing even with fresh installation? This is not really developer friendly...
I am also getting the same error message:
In WebsiteRepository.php line 159:
[DomainException]
The default website isn't defined. Set the website and try again.
Hi @tudalrik-ls ,
I have found this part. I don't know if it will help.
Issue: Magento displays this error message during installation of Magento with third-party extensions that have dependencies on APIs for the Store module in CLI commands: The default website isn't defined. Set the website and try again. Workaround: Remove dependencies on third-party extensions from Composer, install Magento, and then install third-party extensions.
https://devdocs.magento.com/guides/v2.4/release-notes/release-notes-2-4-0-commerce.html
Hi @bnymn
do you see any context?
@jissereitsma postet this: https://twitter.com/jissereitsma/status/1288177211934150656?s=12
Ok, here we go with 2.4: Declaration of Dotdigitalgroup\Email\Test\Integration\Model\Sync\Review\ReviewTest::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void in dotmailer/dotmailer-magento2-extension/Test/Integration/Model/Sync/Review/ReviewTest.php So apparently, the new out of the box Magento 2.4 breaks Integration Tests, thanks to unchecked third party extensions. Why was this released without a proper pre-release? Fixed it by removing all bundled extensions again!!!: composer require yireo/magento2-replace-bundled --no-update; rm -r vendor/ composer.lock; composer install
Hi @tudalrik-ls ,
When I run the integration tests, the dependency manager resolves and initializes all console commands. If any of them depends on the Store class, then you will get that error.
I did not have any external package in my project. However, I had my custom module with a console command. So, I have replaced it with a Proxy in di.xml. Problem solved.
You can put a break point here: In WebsiteRepository.php line 159, then look through the function call stack. There, you will see one of the Command class triggers Store class to load.
The tweet is talking about something else though. The return type is added to the new version of PHPUnit, on the other hand, some third party extensions are not compatible with that.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!
@bnymn how do you find the problem dependency? If I look at the stack trace, there doesn't seem to be a dependency module in there:
DomainException: The default website isn't defined. Set the website and try again. in app/code/Magento/Store/Model/WebsiteRepository.php:159
Stack trace:
#0 app/code/Magento/Store/Model/StoreResolver/Website.php(49): Magento\Store\Model\WebsiteRepository->getDefault()
#1 app/code/Magento/Store/Model/StoresData.php(67): Magento\Store\Model\StoreResolver\Website->getAllowedStoreIds(NULL)
#2 app/code/Magento/Store/Model/StoreResolver.php(138): Magento\Store\Model\StoresData->getStoresData('website', NULL)
#3 app/code/Magento/Store/Model/StoreResolver.php(97): Magento\Store\Model\StoreResolver->getStoresData()
#4 app/code/Magento/Store/Model/StoreManager.php(160): Magento\Store\Model\StoreResolver->getCurrentStoreId()
#5 dev/tests/integration/framework/Magento/TestFramework/Store/StoreManager.php(88): Magento\Store\Model\StoreManager->getStore(NULL)
#6 dev/tests/integration/tmp/sandbox-0-14871485b9d8e028b7f1f97fb2d718416e12671f162cb7498b941b7eaa3245b7/generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php(119): Magento\TestFramework\Store\StoreManager->getStore(NULL)
#7 app/code/Magento/Store/Model/Resolver/Store.php(30): Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL)
#8 lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php(49): Magento\Store\Model\Resolver\Store->getScope(NULL)
#9 dev/tests/integration/framework/Magento/TestFramework/App/Config.php(80): Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores', NULL)
#10 dev/tests/integration/framework/Magento/TestFramework/App/MutableScopeConfig.php(50): Magento\TestFramework\App\Config->setValue('customer/passwo...', 0, 'stores', NULL)
#11 dev/tests/integration/framework/Magento/TestFramework/Config.php(38): Magento\TestFramework\App\MutableScopeConfig->setValue('customer/passwo...', 0, 'store')
#12 dev/tests/integration/framework/Magento/TestFramework/Application.php(468): Magento\TestFramework\Config->rewriteAdditionalConfig()
#13 dev/tests/integration/framework/bootstrap.php(95): Magento\TestFramework\Application->initialize(Array)
#14 vendor/phpunit/phpunit/src/Util/FileLoader.php(65): include_once('/Users/Pro...')
#15 vendor/phpunit/phpunit/src/Util/FileLoader.php(49): PHPUnit\Util\FileLoader::load('/Users/Pro...')
#16 vendor/phpunit/phpunit/src/TextUI/Command.php(562): PHPUnit\Util\FileLoader::checkAndLoad('/Users/Pro...')
#17 vendor/phpunit/phpunit/src/TextUI/Command.php(344): PHPUnit\TextUI\Command->handleBootstrap('/Users/Pro...')
#18 vendor/phpunit/phpunit/src/TextUI/Command.php(111): PHPUnit\TextUI\Command->handleArguments(Array)
#19 vendor/phpunit/phpunit/src/TextUI/Command.php(96): PHPUnit\TextUI\Command->run(Array, true)
#20 vendor/phpunit/phpunit/phpunit(92): PHPUnit\TextUI\Command::main()
#21 {main}
It turns out in my case I had to change from:
<const name="TESTS_CLEANUP" value="true"/>
to:
<const name="TESTS_CLEANUP" value="enabled"/>
I also deleted all database tables, deleted the caches from dev/tests/integration/tmp/*, and ran phpunit once with no parameters:
cd dev/tests/integration
../../../vendor/bin/phpunit
This rebuilt a clean database.
When running integration tests, Magento does not load configurations from this file
config.local.php
located in the sandbox. This file is created when Magento first builds the sandbox environment based on this constantTESTS_GLOBAL_CONFIG_FILE
defined in thephpunit.xml
.Preconditions (*)
dev/tests/integration/etc/config-global.php.dist
file:return [ 'customer/password/limit_password_reset_requests_method' => 0, 'admin/security/admin_account_sharing' => 1, 'admin/security/limit_password_reset_requests_method' => 0, ];
<?php declare(strict_types=1);
use Magento\Framework\App\Config\ScopeConfigInterface; use PHPUnit\Framework\TestCase; use Magento\TestFramework\Helper\Bootstrap;
class ConfigTest extends TestCase { /**
@var ScopeConfigInterface */ private $scopeConfig;
protected function setUp() { $this->scopeConfig = Bootstrap::getObjectManager()->get(ScopeConfigInterface::class); }
/**
Expected result (*)
Actual result (*)