You are here

public function EnvironmentTest::providerTestCheckMemoryLimit in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php \Drupal\Tests\Component\Utility\EnvironmentTest::providerTestCheckMemoryLimit()

Provides data for testCheckMemoryLimit().

Return value

array An array of arrays, each containing the arguments for \Drupal\Component\Utility\Environment::checkMemoryLimit(): required and memory_limit, and the expected return value.

File

core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php, line 51
Contains \Drupal\Tests\Component\Utility\EnvironmentTest.

Class

EnvironmentTest
Test PHP Environment helper methods.

Namespace

Drupal\Tests\Component\Utility

Code

public function providerTestCheckMemoryLimit() {
  $memory_limit = ini_get('memory_limit');
  $twice_avail_memory = $memory_limit * 2 . 'MB';
  return array(
    // Minimal amount of memory should be available.
    array(
      '30MB',
      NULL,
      TRUE,
    ),
    // Exceed a custom (unlimited) memory limit.
    array(
      $twice_avail_memory,
      -1,
      TRUE,
    ),
    // Exceed a custom memory limit.
    array(
      '30MB',
      '16MB',
      FALSE,
    ),
    // Available = required.
    array(
      '30MB',
      '30MB',
      TRUE,
    ),
  );
}