Skip to content

Commit

Permalink
Merge pull request #506 from magento-cia/cia-2.4.8-beta1-develop-2.4-…
Browse files Browse the repository at this point in the history
…develop-sync-09122024

Cia 2.4.8 beta1 develop 2.4 develop sync 09122024
  • Loading branch information
pawan-adobe-security authored Sep 13, 2024
2 parents c5ba965 + 48eb494 commit 95161e8
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<severity value="CRITICAL"/>
<group value="msi"/>
<group value="multi_mode"/>
<!-- will be fixed in the scope of ACQE-6589 -->
<group value="pr_exclude"/>
</annotations>

<before>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder"/>
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"/>
<!--Run queue consumer.-->
<magentoCLI command="queue:consumers:start" arguments="inventory.reservations.updateSalabilityStatus" stepKey="startSalabilityUpdate" timeout="30"/>
<magentoCLI command="queue:consumers:start" arguments="inventory.reservations.updateSalabilityStatus" stepKey="startSalabilityUpdate" timeout="60"/>
<wait time="30" stepKey="waitForSalabilityUpdate"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
</actionGroup>
<!--Navigate to group product PDP.-->
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="navigateToGroupedProductPDPAfterOrderPlacement">
<argument name="product" value="$groupedProduct$"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function afterGetSelect(
. " AND entity_status_store.store_id = {$storeId}",
[]
)->where(
$select->getConnection()->getIfNullSql('entity_status_global.value', 'entity_status_store.value') . ' = ?',
$select->getConnection()->getIfNullSql('entity_status_store.value', 'entity_status_global.value') . ' = ?',
ProductStatus::STATUS_ENABLED
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php
/*************************
*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* ***********************
*/
declare(strict_types=1);

namespace Magento\InventoryConfigurableProduct\Test\Unit\Plugin\Model\ResourceModel\Attribute;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\DB\Select;
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
use Magento\Framework\App\ScopeInterface;
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
use Magento\ConfigurableProduct\Model\ResourceModel\Attribute\OptionSelectBuilderInterface;
use Magento\Framework\EntityManager\EntityMetadataInterface;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\InventoryConfigurableProduct\Plugin\Model\ResourceModel\Attribute\IsEnabledOptionSelectBuilder;
use Magento\Store\Model\Store;
use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus;
use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class IsEnabledOptionSelectBuilderTest extends TestCase
{
/**
* @var ProductAttributeRepositoryInterface|MockObject
*/
private ProductAttributeRepositoryInterface $attributeRepository;

/**
* @var MetadataPool|MockObject
*/
private MetadataPool $metadataPool;

/**
* @inheritdoc
*/
protected function setUp(): void
{
$this->attributeRepository = $this->createMock(ProductAttributeRepositoryInterface::class);
$this->metadataPool = $this->createMock(MetadataPool::class);
}

/**
* @return void
* @throws NoSuchEntityException
* @throws Exception
*/
public function testAfterGetSelect(): void
{
$subject = $this->createMock(OptionSelectBuilderInterface::class);
$superAttribute = $this->createMock(AbstractAttribute::class);
$productId = 1;

$scope = $this->createMock(ScopeInterface::class);
$scope->expects($this->once())->method('getId')->willReturn(1);

$status = $this->createMock(AbstractAttribute::class);
$status->expects($this->exactly(2))
->method('getBackendTable')
->willReturn('catalog_product_entity_int');
$status->expects($this->exactly(2))->method('getAttributeId')->willReturn(95);

$metadata = $this->createMock(EntityMetadataInterface::class);
$metadata->expects($this->once())->method('getLinkField')->willReturn('row_id');
$this->metadataPool->expects($this->once())->method('getMetadata')
->with(ProductInterface::class)
->willReturn($metadata);
$this->attributeRepository->expects($this->once())
->method('get')
->with(ProductInterface::STATUS)
->willReturn($status);

$adapter = $this->createMock(AdapterInterface::class);
$adapter->expects($this->once())
->method('getIfNullSql')
->with('entity_status_store.value', 'entity_status_global.value')
->willReturn('IFNULL(entity_status_store.value, entity_status_global.value) = 1');

$select = $this->createMock(Select::class);
$select->expects($this->once())->method('getConnection')->willReturn($adapter);
$select->expects($this->once())->method('joinInner')->with(
['entity_status_global' => 'catalog_product_entity_int'],
"entity_status_global.row_id = entity.row_id"
. " AND entity_status_global.attribute_id = 95"
. " AND entity_status_global.store_id = " . Store::DEFAULT_STORE_ID,
[]
)->willReturnSelf();
$select->expects($this->once())->method('joinLeft')->with(
['entity_status_store' => 'catalog_product_entity_int'],
"entity_status_store.row_id = entity.row_id"
. " AND entity_status_store.attribute_id = 95"
. " AND entity_status_store.store_id = 1",
[]
)->willReturnSelf();
$select->expects($this->once())->method('where')->with(
'IFNULL(entity_status_store.value, entity_status_global.value) = 1 = ?',
ProductStatus::STATUS_ENABLED
)->willReturnSelf();

$plugin = new IsEnabledOptionSelectBuilder($this->attributeRepository, $this->metadataPool);
$plugin->afterGetSelect($subject, $select, $superAttribute, $productId, $scope);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
*/
public function execute(): string
{
$apiKey = trim((string) $this->scopeConfig->getValue(self::XML_PATH_API_KEY));
$apiKey = trim((string) $this->scopeConfig->getValue(self::XML_PATH_API_KEY) ?? '');
if (!$apiKey) {
throw new LocalizedException(__('Google API key is not defined'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ private function getCountry(string $searchTerm): ?string
}
$searchTerm = explode($this->delimiterConfig->getDelimiter(), $searchTerm);

return trim(end($searchTerm));
return trim(end($searchTerm) ?? '');
}
}
1 change: 0 additions & 1 deletion InventoryInStorePickup/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<preference for="Magento\InventoryInStorePickupApi\Api\GetPickupLocationsInterface" type="Magento\InventoryInStorePickup\Model\GetPickupLocations" />
<preference for="Magento\InventoryInStorePickupApi\Model\GetPickupLocationInterface" type="Magento\InventoryInStorePickup\Model\GetPickupLocation"/>
<preference for="Magento\InventoryInStorePickupApi\Api\Data\SearchResultInterface" type="Magento\InventoryInStorePickup\Model\SearchResult"/>
<preference for="Magento\InventoryInStorePickupApi\Model\SearchResult\ExtractStrategyInterface" type="Magento\InventoryInStorePickup\Model\SearchResult\ExtractStrategy" />
<type name="Magento\InventoryInStorePickupApi\Model\SearchCriteriaResolverInterface">
<arguments>
<argument name="resolvers" xsi:type="array">
Expand Down
2 changes: 0 additions & 2 deletions InventoryInStorePickupShipping/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\InventoryInStorePickupShippingApi\Model\Carrier\Command\GetFreePackagesInterface" type="Magento\InventoryInStorePickupShipping\Model\Carrier\Command\GetFreePackages" />
<preference for="Magento\InventoryInStorePickupShippingApi\Api\Data\ShippingPriceRequestInterface" type="Magento\InventoryInStorePickupShipping\Model\Carrier\ShippingPriceRequest" />
<preference for="Magento\InventoryInStorePickupShippingApi\Model\Carrier\Command\GetShippingPriceInterface" type="Magento\InventoryInStorePickupShipping\Model\Carrier\Command\GetShippingPrice" />
<preference for="Magento\InventoryInStorePickupShippingApi\Model\Carrier\Command\GetShippingPriceRequestInterface" type="Magento\InventoryInStorePickupShipping\Model\Carrier\Command\GetShippingPriceRequest" />
<preference for="Magento\InventoryInStorePickupShippingApi\Model\IsInStorePickupDeliveryCartInterface" type="Magento\InventoryInStorePickupShipping\Model\IsInStorePickupDeliveryCart" />
<preference for="Magento\InventoryInStorePickupShippingApi\Model\IsInStorePickupDeliveryAvailableForCartInterface" type="Magento\InventoryInStorePickupShipping\Model\IsInStorePickupDeliveryAvailableForCart"/>
<type name="Magento\InventoryInStorePickupShippingApi\Model\Carrier\Validation\RequestValidatorChain">
Expand Down
8 changes: 6 additions & 2 deletions InventoryReservations/Model/ReservationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public function build(): ReservationInterface
}

/**
* Validate
*
* @return ValidationResult
*/
private function validate()
Expand All @@ -143,7 +145,7 @@ private function validate()
$errors[] = __('"%field" is expected to be a number.', ['field' => ReservationInterface::STOCK_ID]);
}

if (null === $this->sku || '' === trim($this->sku)) {
if (null === $this->sku || '' === trim($this->sku ?? '')) {
$errors[] = __('"%field" can not be empty.', ['field' => ReservationInterface::SKU]);
}

Expand All @@ -156,6 +158,7 @@ private function validate()

/**
* Used to clean state after object creation
*
* @return void
*/
private function reset()
Expand All @@ -168,7 +171,8 @@ private function reset()

/**
* Used to convert database field names (that use snake case) into constructor parameter names (that use camel case)
* to avoid to define them twice in domain model interface.
*
* To avoid to define them twice in domain model interface.
*
* @param array $array
* @return array
Expand Down

0 comments on commit 95161e8

Please sign in to comment.