You are here

public function LicenseFileManagerTest::testDownloadLimit in Commerce File 8.2

@covers ::getDownloadLimit

File

tests/src/Kernel/LicenseFileManagerTest.php, line 101

Class

LicenseFileManagerTest
Tests the license file manager.

Namespace

Drupal\Tests\commerce_file\Kernel

Code

public function testDownloadLimit() {
  $this
    ->assertEquals(2, $this->licenseFileManager
    ->getDownloadLimit($this->license));
  $this->license
    ->set('file_download_limit', 0);
  $this
    ->assertEquals(0, $this->licenseFileManager
    ->getDownloadLimit($this->license));
  $this->license
    ->set('file_download_limit', NULL);
  $this
    ->assertEquals(0, $this->licenseFileManager
    ->getDownloadLimit($this->license));
  $this
    ->config('commerce_file.settings')
    ->set('enable_download_limit', TRUE)
    ->set('download_limit', 50)
    ->save();
  $this
    ->assertEquals(50, $this->licenseFileManager
    ->getDownloadLimit($this->license));
}