diff --git a/Test/Unit/Cron/CleanupNotificationsTest.php b/Test/Unit/Cron/CleanupNotificationsTest.php index 6520e53bb..d8c7959cb 100644 --- a/Test/Unit/Cron/CleanupNotificationsTest.php +++ b/Test/Unit/Cron/CleanupNotificationsTest.php @@ -19,8 +19,6 @@ use Adyen\Payment\Model\Notification; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; use Magento\Framework\DB\Adapter\DeadlockException; -use Magento\Store\Api\Data\StoreInterface; -use Magento\Store\Model\StoreManagerInterface; use PHPUnit\Framework\MockObject\MockObject; class CleanupNotificationsTest extends AbstractAdyenTestCase @@ -28,33 +26,24 @@ class CleanupNotificationsTest extends AbstractAdyenTestCase protected ?CleanupNotifications $cleanupNotifications; protected AdyenLogger|MockObject $adyenLoggerMock; protected Config|MockObject $configHelperMock; - protected StoreManagerInterface|MockObject $storeManagerMock; protected AdyenNotificationRepositoryInterface|MockObject $adyenNotificationRepositoryMock; protected NotificationsProviderInterface|MockObject $notificationsProvider; protected array $providers; - const STORE_ID = PHP_INT_MAX; - protected function setUp(): void { $this->adyenLoggerMock = $this->createMock(AdyenLogger::class); $this->configHelperMock = $this->createMock(Config::class); - $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); $this->adyenNotificationRepositoryMock = $this->createMock(AdyenNotificationRepositoryInterface::class); $this->notificationsProvider = $this->createMock(NotificationsProviderInterface::class); $this->providers[] = $this->notificationsProvider; - $storeMock = $this->createMock(StoreInterface::class); - $storeMock->method('getId')->willReturn(self::STORE_ID); - $this->storeManagerMock->method('getStore')->willReturn($storeMock); - $this->cleanupNotifications = new CleanupNotifications( $this->providers, $this->adyenLoggerMock, $this->configHelperMock, - $this->storeManagerMock, $this->adyenNotificationRepositoryMock ); } @@ -68,7 +57,6 @@ public function testExecuteConfigEnabled() { $this->configHelperMock->expects($this->once()) ->method('getIsWebhookCleanupEnabled') - ->with(self::STORE_ID) ->willReturn(true); $notificationMock = $this->createMock(Notification::class); @@ -90,7 +78,6 @@ public function testExecuteConfigDisabled() { $this->configHelperMock->expects($this->once()) ->method('getIsWebhookCleanupEnabled') - ->with(self::STORE_ID) ->willReturn(false); $this->notificationsProvider->expects($this->never())->method('provide'); @@ -104,7 +91,6 @@ public function testExecuteException() { $this->configHelperMock->expects($this->once()) ->method('getIsWebhookCleanupEnabled') - ->with(self::STORE_ID) ->willReturn(true); $notificationMock = $this->createMock(Notification::class); diff --git a/Test/Unit/Cron/Providers/ProcessedOldNotificationsProviderTest.php b/Test/Unit/Cron/Providers/ProcessedOldNotificationsProviderTest.php index 13112d41c..0f46cc7e4 100644 --- a/Test/Unit/Cron/Providers/ProcessedOldNotificationsProviderTest.php +++ b/Test/Unit/Cron/Providers/ProcessedOldNotificationsProviderTest.php @@ -21,8 +21,6 @@ use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Api\SearchResultsInterface; use Magento\Framework\Exception\LocalizedException; -use Magento\Store\Api\Data\StoreInterface; -use Magento\Store\Model\StoreManagerInterface; use PHPUnit\Framework\MockObject\MockObject; class ProcessedOldNotificationsProviderTest extends AbstractAdyenTestCase @@ -31,29 +29,20 @@ class ProcessedOldNotificationsProviderTest extends AbstractAdyenTestCase protected AdyenNotificationRepositoryInterface|MockObject $adyenNotificationRepositoryMock; protected SearchCriteriaBuilder|MockObject $searchCriteriaBuilderMock; protected Config|MockObject $configHelperMock; - protected StoreManagerInterface|MockObject $storeManagerMock; protected AdyenLogger|MockObject $adyenLoggerMock; - const STORE_ID = PHP_INT_MAX; - protected function setUp(): void { $this->adyenNotificationRepositoryMock = $this->createMock(AdyenNotificationRepositoryInterface::class); $this->searchCriteriaBuilderMock = $this->createMock(SearchCriteriaBuilder::class); $this->configHelperMock = $this->createMock(Config::class); - $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); $this->adyenLoggerMock = $this->createMock(AdyenLogger::class); - $storeMock = $this->createMock(StoreInterface::class); - $storeMock->method('getId')->willReturn(self::STORE_ID); - $this->storeManagerMock->method('getStore')->willReturn($storeMock); - $this->notificationsProvider = new ProcessedOldNotificationsProvider( $this->adyenNotificationRepositoryMock, $this->searchCriteriaBuilderMock, $this->configHelperMock, - $this->storeManagerMock, $this->adyenLoggerMock ); } @@ -69,7 +58,6 @@ public function testProvideSuccess() $this->configHelperMock->expects($this->once()) ->method('getRequiredDaysForOldWebhooks') - ->with(self::STORE_ID) ->willReturn($expiryDays); $dateMock = date('Y-m-d H:i:s', time() - $expiryDays * 24 * 60 * 60); @@ -112,7 +100,6 @@ public function testProvideFailure() $this->configHelperMock->expects($this->once()) ->method('getRequiredDaysForOldWebhooks') - ->with(self::STORE_ID) ->willReturn($expiryDays); $dateMock = date('Y-m-d H:i:s', time() - $expiryDays * 24 * 60 * 60); diff --git a/Test/Unit/Helper/ConfigTest.php b/Test/Unit/Helper/ConfigTest.php index abbbdb780..6179af521 100644 --- a/Test/Unit/Helper/ConfigTest.php +++ b/Test/Unit/Helper/ConfigTest.php @@ -172,8 +172,6 @@ public function testGetIsCvcRequiredForRecurringCardPayments() public function testGetIsWebhookCleanupEnabled() { - $storeId = PHP_INT_MAX; - $path = sprintf( "%s/%s/%s", Config::XML_PAYMENT_PREFIX, @@ -183,17 +181,15 @@ public function testGetIsWebhookCleanupEnabled() $this->scopeConfigMock->expects($this->once()) ->method('isSetFlag') - ->with($this->equalTo($path), $this->equalTo(ScopeInterface::SCOPE_STORE), $this->equalTo($storeId)) + ->with($this->equalTo($path), $this->equalTo(ScopeInterface::SCOPE_STORE), $this->equalTo(null)) ->willReturn(true); - $result = $this->configHelper->getIsWebhookCleanupEnabled($storeId); + $result = $this->configHelper->getIsWebhookCleanupEnabled(); $this->assertTrue($result); } public function testGetRequiredDaysForOldWebhooks() { - $storeId = PHP_INT_MAX; - $path = sprintf( "%s/%s/%s", Config::XML_PAYMENT_PREFIX, @@ -203,10 +199,10 @@ public function testGetRequiredDaysForOldWebhooks() $this->scopeConfigMock->expects($this->once()) ->method('getValue') - ->with($this->equalTo($path), $this->equalTo(ScopeInterface::SCOPE_STORE), $this->equalTo($storeId)) + ->with($this->equalTo($path), $this->equalTo(ScopeInterface::SCOPE_STORE), $this->equalTo(null)) ->willReturn("90"); - $result = $this->configHelper->getRequiredDaysForOldWebhooks($storeId); + $result = $this->configHelper->getRequiredDaysForOldWebhooks(); $this->assertIsInt($result); $this->assertEquals(90, $result); }