Skip to content

Commit 4bab8d2

Browse files
authored
Merge pull request #896 from pradeepkanaka/fix-app-issue
Fix app issue - PHPCS warnings
2 parents c743036 + f9d0095 commit 4bab8d2

File tree

49 files changed

+498
-486
lines changed

Some content is hidden

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

49 files changed

+498
-486
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
use Meta\BusinessExtension\Api\AdobeCloudConfigInterface;
2424
use Magento\Framework\Filesystem\DirectoryList;
25+
use Magento\Framework\Filesystem\Driver\File;
2526

2627
class AdobeCloudConfig implements AdobeCloudConfigInterface
2728
{
@@ -39,15 +40,23 @@ class AdobeCloudConfig implements AdobeCloudConfigInterface
3940
*/
4041
private $directoryList;
4142

43+
/**
44+
* @var File
45+
*/
46+
private $file;
47+
4248
/**
4349
* Class constructor
4450
*
4551
* @param DirectoryList $directoryList
52+
* @param File $file
4653
*/
4754
public function __construct(
48-
DirectoryList $directoryList
55+
DirectoryList $directoryList,
56+
File $file
4957
) {
5058
$this->directoryList = $directoryList;
59+
$this->file = $file;
5160
}
5261

5362
/**
@@ -60,8 +69,11 @@ public function isSellerOnAdobeCloud(): bool
6069
$rootPath = $this->directoryList->getRoot();
6170

6271
foreach (self::CLOUD_FILES as $file) {
63-
if (file_exists($rootPath . '/' . $file)) {
64-
return true;
72+
try {
73+
if ($this->file->isExists($rootPath . '/' . $file)) {
74+
return true;
75+
}
76+
} catch (\Exception $ex) {
6577
}
6678
}
6779

app/code/Meta/BusinessExtension/Test/Unit/Api/AdobeCloudConfigTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AdobeCloudConfigTest extends TestCase
1818

1919
/**
2020
* Class setup function
21-
*
21+
*
2222
* @return void
2323
*/
2424
protected function setUp(): void
@@ -33,7 +33,7 @@ protected function setUp(): void
3333

3434
/**
3535
* Validate if seller is on Cloud
36-
*
36+
*
3737
* @return void
3838
*/
3939
public function testIsSellerOnAdobeCloudReturnsTrueWhenEnvVarIsSet(): void
@@ -47,7 +47,7 @@ public function testIsSellerOnAdobeCloudReturnsTrueWhenEnvVarIsSet(): void
4747

4848
/**
4949
* Validate if seller is on-premise
50-
*
50+
*
5151
* @return void
5252
*/
5353
public function testIsSellerOnAdobeCloudReturnsFalseWhenEnvVarIsNotSet(): void
@@ -60,7 +60,7 @@ public function testIsSellerOnAdobeCloudReturnsFalseWhenEnvVarIsNotSet(): void
6060

6161
/**
6262
* Validate if seller is on-premise
63-
*
63+
*
6464
* @return void
6565
*/
6666
public function testGetCommercePartnerSellerPlatformType(): void
@@ -73,7 +73,7 @@ public function testGetCommercePartnerSellerPlatformType(): void
7373

7474
/**
7575
* Validate if seller is on-premise
76-
*
76+
*
7777
* @return void
7878
*/
7979
public function testGetCommercePartnerSellerPlatformTypeIsNotOnCloud(): void

app/code/Meta/BusinessExtension/Test/Unit/Api/CoreConfigFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function setUp(): void
3636

3737
/**
3838
* Test create method
39-
*
39+
*
4040
* @return void
4141
*/
4242
public function testCreate(): void
@@ -57,7 +57,7 @@ public function testCreate(): void
5757

5858
/**
5959
* Get data for testing
60-
*
60+
*
6161
* @return array
6262
*/
6363
private function getData()

app/code/Meta/BusinessExtension/Test/Unit/Api/CoreConfigTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CoreConfigTest extends TestCase
1717

1818
/**
1919
* Class setup function
20-
*
20+
*
2121
* @return void
2222
*/
2323
protected function setup(): void
@@ -35,19 +35,19 @@ protected function setup(): void
3535

3636
/**
3737
* Validate if the external business ID is empty
38-
*
38+
*
3939
* @return void
4040
*/
4141
public function testGetExternalBusinessId(): void
42-
{
42+
{
4343
$businessId = 'ZmJfaWRfMQ==';
4444
$this->metaCoreConfig->setExternalBusinessId($businessId);
4545
$this->assertEquals($businessId, $this->metaCoreConfig->getExternalBusinessId());
4646
}
4747

4848
/**
4949
* Validate if the order sync is enabled
50-
*
50+
*
5151
* @return void
5252
*/
5353
public function testSetIsOrderSyncEnabled(): void
@@ -60,7 +60,7 @@ public function testSetIsOrderSyncEnabled(): void
6060

6161
/**
6262
* Validate if the catalog sync is enabled
63-
*
63+
*
6464
* @return void
6565
*/
6666
public function testSetIsCatalogSyncEnabled(): void
@@ -73,7 +73,7 @@ public function testSetIsCatalogSyncEnabled(): void
7373

7474
/**
7575
* Validate if the Promotion sync is enabled
76-
*
76+
*
7777
* @return void
7878
*/
7979
public function testSetIsPromotionsSyncEnabled(): void
@@ -86,7 +86,7 @@ public function testSetIsPromotionsSyncEnabled(): void
8686

8787
/**
8888
* Validate if the extension is active
89-
*
89+
*
9090
* @return void
9191
*/
9292
public function testSetIsActiveExtension(): void
@@ -99,7 +99,7 @@ public function testSetIsActiveExtension(): void
9999

100100
/**
101101
* Validate if the product identifier attribute is set
102-
*
102+
*
103103
* @return void
104104
*/
105105
public function testSetProductIdentifierAttr(): void
@@ -112,7 +112,7 @@ public function testSetProductIdentifierAttr(): void
112112

113113
/**
114114
* Validate if the product stock threashold is set
115-
*
115+
*
116116
* @return void
117117
*/
118118
public function testSetOutOfStockThreshold(): void
@@ -125,7 +125,7 @@ public function testSetOutOfStockThreshold(): void
125125

126126
/**
127127
* Validate if the feed ID is set
128-
*
128+
*
129129
* @return void
130130
*/
131131
public function testSetFeedId(): void
@@ -138,7 +138,7 @@ public function testSetFeedId(): void
138138

139139
/**
140140
* Validate if the installed meta extension version is set
141-
*
141+
*
142142
* @return void
143143
*/
144144
public function testSetInstalledMetaExtensionVersion(): void
@@ -151,7 +151,7 @@ public function testSetInstalledMetaExtensionVersion(): void
151151

152152
/**
153153
* Validate if the Graph API version is set
154-
*
154+
*
155155
* @return void
156156
*/
157157
public function testSetGraphApiVersion(): void
@@ -164,7 +164,7 @@ public function testSetGraphApiVersion(): void
164164

165165
/**
166166
* Validate if the Graph API version is set
167-
*
167+
*
168168
* @return void
169169
*/
170170
public function testSetMagentoVersion(): void

app/code/Meta/BusinessExtension/Test/Unit/Api/CustomApiKey/APIKeyServiceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function testGetCustomApiKeyWithNull()
7979
);
8080
$this->logger->expects($this->exactly(2))
8181
->method('info')
82-
->withConsecutive(['API key does not exist. Generating a new key.'],['API key has been generated and saved.'])
82+
->withConsecutive(['API key does not exist. Generating a new key.'], ['API key has been generated and saved.'])
8383
->willReturnSelf();
8484
$this->configWriter->expects($this->once())->method('save');
8585
$result = $apiKeyService->getCustomApiKey();

app/code/Meta/BusinessExtension/Test/Unit/Api/SettingsWebhookListenerImplTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class SettingsWebhookListenerImplTest extends TestCase
7373

7474
/**
7575
* Class setup function
76-
*
76+
*
7777
* @return void
7878
*/
7979
protected function setUp(): void
@@ -107,7 +107,7 @@ protected function setUp(): void
107107

108108
/**
109109
* Validate if the settings webhook listener is working as expected
110-
*
110+
*
111111
* @return void
112112
*/
113113
public function testGetCoreConfig(): void
@@ -152,4 +152,4 @@ public function testGetCoreConfig(): void
152152
$actual = $this->settingsWebhookListenerImplMockObj->getCoreConfig($externalBusinessId);
153153
$this->assertInstanceOf(CoreConfigInterface::class, $actual);
154154
}
155-
}
155+
}

app/code/Meta/BusinessExtension/Test/Unit/Api/SettingsWebhookRequestImplTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SettingsWebhookRequestImplTest extends TestCase
1818

1919
/**
2020
* Class setup function
21-
*
21+
*
2222
* @return void
2323
*/
2424
protected function setUp(): void
@@ -32,7 +32,7 @@ protected function setUp(): void
3232

3333
/**
3434
* Validate if the settings external business ID is working
35-
*
35+
*
3636
* @return void
3737
*/
3838
public function testSetExternalBusinessId(): void
@@ -45,7 +45,7 @@ public function testSetExternalBusinessId(): void
4545

4646
/**
4747
* Validate if the settings notification is working
48-
*
48+
*
4949
* @return void
5050
*/
5151
public function testSetNotification(): void
@@ -65,7 +65,7 @@ public function testSetNotification(): void
6565

6666
/**
6767
* Validate if the graphql version is set correctly
68-
*
68+
*
6969
* @return void
7070
*/
7171
public function testSetGraphAPIVersion(): void
@@ -75,4 +75,4 @@ public function testSetGraphAPIVersion(): void
7575

7676
$this->assertEquals($graphqlVersion, $this->settingsWebhookRequestImpl->getGraphAPIVersion());
7777
}
78-
}
78+
}

0 commit comments

Comments
 (0)