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

Add default Source in Data Install. #107

Merged
merged 6 commits into from Oct 4, 2017
Merged

Conversation

bartekszymanski
Copy link
Contributor

@bartekszymanski bartekszymanski commented Sep 26, 2017

Description

Fixed Issues (if relevant)

  1. Add default Source in Data Install.  #41: Add default Source in Data Install

Manual testing scenarios

  1. Remove data version from table "setup_module", Magento_InventoryCatalog module
  2. Run bin/magento setup:upgrade
  3. Default source should be visible in table "inventory_source" with id: 1

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

DataObjectHelper $dataObjectHelper
) {
$this->sourceRepository = $sourceRepository;
$this->objectManager = $objectManager;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⁉️ 💥 Pls don't use the object manager inject the SourceInterface

self::assertEquals('Default Source', $this->source->getName());
}

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⁉️ Coding Style Newline is missing

}

/**
* Test is default source wxist in DB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in wxist you mean exist?

}

/**
* @return void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls add documentation for function

DataObjectHelper $dataObjectHelper
) {
$this->sourceRepository = $sourceRepository;
$this->source = $source;
Copy link

@naydav naydav Sep 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls use autogenerated factory for creating new Data objects
Unlike from services Data Objects have state and does not suppose to be shareable objects

private function addDefaultSource()
{
$data = [
SourceInterface::SOURCE_ID => 1,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to move default Stock data to configuration
It will provide possibility to replace this data with another's modules

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to leave it as-is now.

Because we need a decision from PO @mbrinton01 here, regarding Default Source data. And from where to take it.
I suppose it could be some XML configuration with an ability to overwrite it from another module.
But what the data would be stored there?

class DefaultSource extends TestCase
{
/**
* @var Source
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong type
We work with repository

* Class DefaultSource
* @package Magento\Inventory\Test\Integration\Source
*/
class DefaultSource extends TestCase
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultSourceTest

*/
protected function setUp()
{
$this->source = Bootstrap::getObjectManager()->create(SourceRepositoryInterface::class);
Copy link

@naydav naydav Sep 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use get method instead of create because we do not need to create new instance of Repository
Services are shared objects (without any state) unlike from Data object classes

* Class DefaultSource
* @package Magento\Inventory\Test\Integration\Source
*/
class DefaultSource extends TestCase
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maghamed
What do think, maybe is better to create WebApi test instead of Integration?
Because Default Stocks looks like part of api provided CatalogInventory bridge module

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naydav yes, web api test in InventoryCatlog module makes sense

* See COPYING.txt for license details.
*/

namespace Magento\Inventory\Setup;
Copy link

@naydav naydav Sep 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maghamed
If I am not mistaken we decided to put this functionality in bridge module (which @bartekszymanski introduced on Contribution Day)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naydav good catch!

yeah, that should be placed in InventoryCatalog module

protected function setUp()
{
$this->source = Bootstrap::getObjectManager()->create(SourceRepositoryInterface::class);
$this->source = $this->source->get(1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->source->get(1) looks like as part of testDefaultSourceExist test
Maybe need to move from setUp (where only initialization should be placed) to corresponding test method

* See COPYING.txt for license details.
*/

namespace Magento\Inventory\Setup;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naydav good catch!

yeah, that should be placed in InventoryCatalog module

private function addDefaultSource()
{
$data = [
SourceInterface::SOURCE_ID => 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to leave it as-is now.

Because we need a decision from PO @mbrinton01 here, regarding Default Source data. And from where to take it.
I suppose it could be some XML configuration with an ability to overwrite it from another module.
But what the data would be stored there?

* Class DefaultSource
* @package Magento\Inventory\Test\Integration\Source
*/
class DefaultSource extends TestCase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naydav yes, web api test in InventoryCatlog module makes sense

SourceInterface::LATITUDE => 0,
SourceInterface::LONGITUDE => 0,
SourceInterface::PRIORITY => 0,
SourceInterface::COUNTRY_ID => 'PL',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to MSI Product Owner @mbrinton01

it should default to US, just because we have more merchants there
and postcode should be 00000
(having no - in the middle)
the other fields can be used as they are now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do I keep this data? Configuration xml or leave it as it is?

@maghamed maghamed merged commit b5bac61 into develop Oct 4, 2017
@maghamed maghamed deleted the default-source-install-data branch December 11, 2018 18:15
magento-cicd2 pushed a commit that referenced this pull request Apr 12, 2021
MC-41614: When dimensions-mode is set to "wesbite" and let price inde…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants