48 ->disableOriginalConstructor()
57 $result = $conditionsBuilder->buildExistingAttributeWebsiteScope(
64 $this->assertEquals([],
$result);
72 $attribute = $this->getMockBuilder(Attribute::class)
73 ->disableOriginalConstructor()
76 $metadata = $this->getMockBuilder(EntityMetadataInterface::class)
77 ->disableOriginalConstructor()
109 ->disableOriginalConstructor()
115 ->method(
'getStore');
118 $result = $conditionsBuilder->buildExistingAttributeWebsiteScope(
125 $this->assertEquals([],
$result);
133 $attribute = $this->getMockBuilder(CatalogEavAttribute::class)
134 ->disableOriginalConstructor()
141 ->method(
'isScopeWebsite')
143 $this->returnValue(
true)
146 $metadata = $this->getMockBuilder(EntityMetadataInterface::class)
147 ->disableOriginalConstructor()
181 ->disableOriginalConstructor()
189 $this->returnValue(
$store)
193 $result = $conditionsBuilder->buildExistingAttributeWebsiteScope(
200 $this->assertEquals([],
$result);
208 $attribute = $this->getMockBuilder(CatalogEavAttribute::class)
209 ->disableOriginalConstructor()
215 ->method(
'isScopeWebsite')
217 $this->returnValue(
true)
220 $metadata = $this->getMockBuilder(EntityMetadataInterface::class)
221 ->disableOriginalConstructor()
224 $scope = $this->getMockBuilder(ScopeInterface::class)
225 ->disableOriginalConstructor()
232 $scope->expects($this->once())
233 ->method(
'getIdentifier')
237 $scope->expects($this->once())
240 $this->returnValue(1)
246 $store = $this->getMockBuilder(Store::class)
247 ->disableOriginalConstructor()
252 $store->expects($this->once())
253 ->method(
'getWebsite')
255 $this->returnValue(
false)
286 array $expectedConditions,
290 ->disableOriginalConstructor()
298 $this->returnValue(
$store)
302 $result = $conditionsBuilder->buildExistingAttributeWebsiteScope(
309 $this->assertEquals($expectedConditions,
$result);
319 $dbAdapater = $this->getMockBuilder(Mysql::class)
320 ->disableOriginalConstructor()
325 $dbAdapater->expects($this->exactly(3))
326 ->method(
'quoteIdentifier')
328 $this->returnCallback(
function ($input) {
329 return sprintf(
'`%s`', $input);
333 $metadata = $this->getMockBuilder(EntityMetadata::class)
334 ->disableOriginalConstructor()
337 'getEntityConnection',
340 $metadata->expects($this->once())
341 ->method(
'getLinkField')
343 $this->returnValue(
'entity_id')
345 $metadata->expects($this->exactly(3))
346 ->method(
'getEntityConnection')
348 $this->returnValue($dbAdapater)
352 $this->getValidScopeMock(),
355 $store = $this->getValidStoreMock();
357 $expectedConditions = [
359 'entity_id = ?' => 5,
360 'attribute_id = ?' => 12,
361 '`store_id` = ?' => 1,
364 'entity_id = ?' => 5,
365 'attribute_id = ?' => 12,
366 '`store_id` = ?' => 2,
369 'entity_id = ?' => 5,
370 'attribute_id = ?' => 12,
371 '`store_id` = ?' => 3,
404 ->disableOriginalConstructor()
410 ->method(
'getStore');
413 $result = $conditionsBuilder->buildNewAttributesWebsiteScope(
420 $this->assertEquals([],
$result);
428 $attribute = $this->getMockBuilder(Attribute::class)
429 ->disableOriginalConstructor()
432 $metadata = $this->getMockBuilder(EntityMetadataInterface::class)
433 ->disableOriginalConstructor()
465 array $expectedConditions,
469 ->disableOriginalConstructor()
477 $this->returnValue(
$store)
481 $result = $conditionsBuilder->buildNewAttributesWebsiteScope(
488 $this->assertEquals($expectedConditions,
$result);
498 $metadata = $this->getMockBuilder(EntityMetadata::class)
499 ->disableOriginalConstructor()
504 $metadata->expects($this->once())
505 ->method(
'getLinkField')
507 $this->returnValue(
'entity_id')
511 $this->getValidScopeMock(),
514 $store = $this->getValidStoreMock();
516 $expectedConditions = [
519 'attribute_id' => 12,
524 'attribute_id' => 12,
529 'attribute_id' => 12,
551 private function getValidAttributeMock()
553 $attribute = $this->getMockBuilder(CatalogEavAttribute::class)
554 ->disableOriginalConstructor()
561 ->method(
'isScopeWebsite')
563 $this->returnValue(
true)
566 ->method(
'getAttributeId')
568 $this->returnValue(12)
577 private function getValidStoreMock()
579 $website = $this->getMockBuilder(Website::class)
580 ->disableOriginalConstructor()
586 ->method(
'getStoreIds')
595 $store = $this->getMockBuilder(Store::class)
596 ->disableOriginalConstructor()
601 $store->expects($this->once())
602 ->method(
'getWebsite')
613 private function getValidScopeMock()
615 $scope = $this->getMockBuilder(ScopeInterface::class)
616 ->disableOriginalConstructor()
623 $scope->expects($this->once())
624 ->method(
'getIdentifier')
628 $scope->expects($this->once())
631 $this->returnValue(1)
buildExistingAttributeWebsiteScopeStoreScopeNotFoundDataProvider()
testBuildExistingAttributeWebsiteScopeStoreWebsiteNotFound(AbstractAttribute $attribute, EntityMetadataInterface $metadata, StoreInterface $store, array $scopes, $linkFieldValue)
testBuildExistingAttributeWebsiteScopeSuccess(AbstractAttribute $attribute, EntityMetadataInterface $metadata, StoreInterface $store, array $scopes, array $expectedConditions, $linkFieldValue)
buildExistingAttributeWebsiteScopeStoreWebsiteNotFoundDataProvider()
buildExistingAttributeWebsiteScopeSuccessDataProvider()
testBuildExistingAttributeWebsiteScopeInappropriateAttribute(AbstractAttribute $attribute, EntityMetadataInterface $metadata, array $scopes, $linkFieldValue)
testBuildExistingAttributeWebsiteScopeStoreScopeNotFound(AbstractAttribute $attribute, EntityMetadataInterface $metadata, array $scopes, $linkFieldValue)
buildExistingAttributeWebsiteScopeInappropriateAttributeDataProvider()
buildNewAttributeWebsiteScopeUnappropriateAttributeDataProvider()
testBuildNewAttributeWebsiteScopeSuccess(AbstractAttribute $attribute, EntityMetadataInterface $metadata, StoreInterface $store, array $scopes, array $expectedConditions, $linkFieldValue)
testBuildNewAttributeWebsiteScopeUnappropriateAttribute(AbstractAttribute $attribute, EntityMetadataInterface $metadata, array $scopes, $linkFieldValue)
buildNewAttributeWebsiteScopeSuccessDataProvider()