Skip to content

Commit 27f82f3

Browse files
authored
Merge branch 'main' into ADO-313-capi-changes
2 parents b748982 + fac8ac0 commit 27f82f3

File tree

149 files changed

+15574
-875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+15574
-875
lines changed

app/code/Meta/BusinessExtension/Block/Adminhtml/System/Config/DeleteConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function getButtonHtml()
120120
*
121121
* @return mixed
122122
*/
123-
protected function getStoreId()
123+
public function getStoreId()
124124
{
125125
$storeId = $this->getRequest()->getParam('store');
126126
if ($storeId === null && $this->systemConfig->isSingleStoreMode()) {

app/code/Meta/BusinessExtension/Controller/Adminhtml/ApiKey/Index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ class Index extends Action
2929
/**
3030
* @var KeyGenerator
3131
*/
32-
protected $apiKeyGenerator;
32+
public $apiKeyGenerator;
3333

3434
/**
3535
* @var WriterInterface
3636
*/
37-
protected $configWriter;
37+
public $configWriter;
3838

3939
/**
4040
* @var LoggerInterface
4141
*/
42-
protected $logger;
42+
public $logger;
4343

4444
/**
4545
* Index constructor

app/code/Meta/BusinessExtension/Helper/GraphAPIAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class GraphAPIAdapter
5555
/**
5656
* @var string
5757
*/
58-
private $graphAPIVersion = 'v20.0';
58+
private $graphAPIVersion = 'v22.0';
5959

6060
/**
6161
* @var Client

app/code/Meta/BusinessExtension/Model/Api/CoreConfigFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CoreConfigFactory
2929
*
3030
* @var ObjectManagerInterface
3131
*/
32-
protected ObjectManagerInterface $objectManager;
32+
public ObjectManagerInterface $objectManager;
3333

3434
/**
3535
* @param ObjectManagerInterface $objectManager

app/code/Meta/BusinessExtension/Model/Api/CustomApiKey/ApiKeyService.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ class ApiKeyService
3333
/**
3434
* @var KeyGenerator
3535
*/
36-
protected $apiKeyGenerator;
36+
public $apiKeyGenerator;
3737

3838
/**
3939
* @var WriterInterface
4040
*/
41-
protected $configWriter;
41+
public $configWriter;
4242

4343
/**
4444
* @var ScopeConfigInterface
4545
*/
46-
protected $scopeConfig;
46+
public $scopeConfig;
4747

4848
/**
4949
* @var LoggerInterface
5050
*/
51-
protected $logger;
51+
public $logger;
5252

5353
/**
5454
* @param KeyGenerator $apiKeyGenerator

app/code/Meta/BusinessExtension/Model/Api/CustomApiKey/Authenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Authenticator
3131
/**
3232
* @var ScopeConfigInterface
3333
*/
34-
protected $scopeConfig;
34+
public $scopeConfig;
3535

3636
/**
3737
* @var Http

app/code/Meta/BusinessExtension/Model/MBEInstalls.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function save($response, $storeId)
134134
$data = $response[0];
135135
$catalogId = $data['catalog_id'] ?? '';
136136
$pixelId = $data['pixel_id'] ?? '';
137-
$onsite_eligible = $data['onsite_eligible'] ?? false;
137+
$onsite_eligible = filter_var($data['onsite_eligible'], FILTER_VALIDATE_BOOLEAN) ?? false;
138138
$commercePartnerIntegrationId = $data['commerce_partner_integration_id'] ?? '';
139139

140140
// we will update catalog config if catalog has been updated in Meta
@@ -151,7 +151,7 @@ public function save($response, $storeId)
151151
$this->savePages($data['pages'] ?? '', $storeId);
152152
$this->saveCatalogId($catalogId, $storeId);
153153
$this->saveCommercePartnerIntegrationId($commercePartnerIntegrationId, $storeId);
154-
$this->saveIsOnsiteEligible($onsite_eligible, $storeId);
154+
$this->saveIsOnsiteEligible($onsite_eligible, (int)$storeId);
155155
$this->saveMerchantSettingsId($data['commerce_merchant_settings_id'] ?? '', $storeId);
156156
$this->saveInstalledFeatures($data['installed_features'] ?? '', $storeId);
157157
$this->setInstalledFlag($storeId);
@@ -285,7 +285,7 @@ public function saveCommercePartnerIntegrationId($commercePartnerIntegrationId,
285285
* @param int $storeId
286286
* @return $this
287287
*/
288-
public function saveIsOnsiteEligible(bool $onsite_eligible, int $storeId): MBEInstalls
288+
public function saveIsOnsiteEligible($onsite_eligible, $storeId): MBEInstalls
289289
{
290290
if ($onsite_eligible) {
291291
$this->fbeHelper->log(

app/code/Meta/BusinessExtension/Model/System/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class Config
158158
*
159159
* @var string|null
160160
*/
161-
private ?string $version = '1.4.1-dev';
161+
private ?string $version = '1.4.3-dev';
162162

163163
/**
164164
* Config class constructor

app/code/Meta/BusinessExtension/Model/System/Message/Notification.php

Lines changed: 0 additions & 116 deletions
This file was deleted.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Meta\BusinessExtension\Test\Unit\Api;
6+
7+
use Meta\BusinessExtension\Model\Api\AdobeCloudConfig;
8+
use Meta\BusinessExtension\Api\AdobeCloudConfigInterface;
9+
use PHPUnit\Framework\TestCase;
10+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
11+
12+
class AdobeCloudConfigTest extends TestCase
13+
{
14+
/**
15+
* @var AdobeCloudConfig
16+
*/
17+
private $adobeCloudConfig;
18+
19+
/**
20+
* Class setup function
21+
*
22+
* @return void
23+
*/
24+
protected function setUp(): void
25+
{
26+
parent::setUp();
27+
$objectManager = new ObjectManager($this);
28+
29+
$this->adobeCloudConfig = $objectManager->getObject(
30+
AdobeCloudConfig::class
31+
);
32+
}
33+
34+
/**
35+
* Validate if seller is on Cloud
36+
*
37+
* @return void
38+
*/
39+
public function testIsSellerOnAdobeCloudReturnsTrueWhenEnvVarIsSet(): void
40+
{
41+
/** check if the envinorment is non-premise */
42+
$_ENV['MAGENTO_CLOUD_ENVIRONMENT'] = 'MAGENTO_CLOUD_ENVIRONMENT';
43+
44+
$this->assertTrue($this->adobeCloudConfig->isSellerOnAdobeCloud());
45+
unset($_ENV['MAGENTO_CLOUD_ENVIRONMENT']);
46+
}
47+
48+
/**
49+
* Validate if seller is on-premise
50+
*
51+
* @return void
52+
*/
53+
public function testIsSellerOnAdobeCloudReturnsFalseWhenEnvVarIsNotSet(): void
54+
{
55+
/** check if the envinorment is on-premise */
56+
unset($_ENV['MAGENTO_CLOUD_ENVIRONMENT']);
57+
58+
$this->assertFalse($this->adobeCloudConfig->isSellerOnAdobeCloud());
59+
}
60+
61+
/**
62+
* Validate if seller is on-premise
63+
*
64+
* @return void
65+
*/
66+
public function testGetCommercePartnerSellerPlatformType(): void
67+
{
68+
/** check if the envinorment is on-premise */
69+
$_ENV['MAGENTO_CLOUD_ENVIRONMENT'] = 'MAGENTO_CLOUD_ENVIRONMENT';
70+
71+
$this->assertSame(AdobeCloudConfigInterface::ADOBE_COMMERCE_CLOUD, $this->adobeCloudConfig->getCommercePartnerSellerPlatformType());
72+
}
73+
74+
/**
75+
* Validate if seller is on-premise
76+
*
77+
* @return void
78+
*/
79+
public function testGetCommercePartnerSellerPlatformTypeIsNotOnCloud(): void
80+
{
81+
/** check if the envinorment is on-premise */
82+
unset($_ENV['MAGENTO_CLOUD_ENVIRONMENT']);
83+
84+
$this->assertSame(AdobeCloudConfigInterface::MAGENTO_OPEN_SOURCE, $this->adobeCloudConfig->getCommercePartnerSellerPlatformType());
85+
}
86+
}

0 commit comments

Comments
 (0)