SystemBackupTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Backup\Test\Unit\Cron;
  8. use Magento\Backup\Cron\SystemBackup;
  9. use PHPUnit\Framework\TestCase;
  10. use Magento\Backup\Helper\Data as Helper;
  11. use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
  12. class SystemBackupTest extends TestCase
  13. {
  14. /**
  15. * @var Helper|\PHPUnit_Framework_MockObject_MockObject
  16. */
  17. private $helperMock;
  18. /**
  19. * @var SystemBackup
  20. */
  21. private $cron;
  22. /**
  23. * @inheritDoc
  24. */
  25. protected function setUp()
  26. {
  27. $objectManager = new ObjectManager($this);
  28. $this->helperMock = $this->getMockBuilder(Helper::class)->disableOriginalConstructor()->getMock();
  29. $this->cron = $objectManager->getObject(SystemBackup::class, ['backupData' => $this->helperMock]);
  30. }
  31. /**
  32. * Test that cron doesn't do anything if backups are disabled.
  33. */
  34. public function testDisabled()
  35. {
  36. $this->helperMock->expects($this->any())->method('isEnabled')->willReturn(false);
  37. $this->cron->execute();
  38. }
  39. }