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
Conversation
DataObjectHelper $dataObjectHelper | ||
) { | ||
$this->sourceRepository = $sourceRepository; | ||
$this->objectManager = $objectManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self::assertEquals('Default Source', $this->source->getName()); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
/** | ||
* Test is default source wxist in DB |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
e7e4897
to
1129d30
Compare
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Inventory\Setup; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
dc06389
to
0963bfb
Compare
MC-41614: When dimensions-mode is set to "wesbite" and let price inde…
Description
Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist