function DiskSpaceValidatorTest::providerDiskSpaceValidation

Data provider for testDiskSpaceValidation().

Return value

mixed[][] The test cases.

File

core/modules/package_manager/tests/src/Kernel/DiskSpaceValidatorTest.php, line 26

Class

DiskSpaceValidatorTest
@covers \Drupal\package_manager\Validator\DiskSpaceValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public static function providerDiskSpaceValidation() : array {
    // @see \Drupal\Tests\package_manager\Traits\ValidationTestTrait::resolvePlaceholdersInArrayValuesWithRealPaths()
    $root = '<PROJECT_ROOT>';
    $vendor = '<VENDOR_DIR>';
    $root_insufficient = t('Drupal root filesystem "<PROJECT_ROOT>" has insufficient space. There must be at least 1024 megabytes free.');
    $vendor_insufficient = t('Vendor filesystem "<VENDOR_DIR>" has insufficient space. There must be at least 1024 megabytes free.');
    $temp_insufficient = t('Directory "temp" has insufficient space. There must be at least 1024 megabytes free.');
    $summary = t("There is not enough disk space to create a stage directory.");
    return [
        'shared, vendor and temp sufficient, root insufficient' => [
            TRUE,
            [
                $root => '1M',
                $vendor => '2G',
                'temp' => '4G',
            ],
            [
                ValidationResult::createError([
                    $root_insufficient,
                ]),
            ],
        ],
        'shared, root and vendor insufficient, temp sufficient' => [
            TRUE,
            [
                $root => '1M',
                $vendor => '2M',
                'temp' => '2G',
            ],
            [
                ValidationResult::createError([
                    $root_insufficient,
                ]),
            ],
        ],
        'shared, vendor and root sufficient, temp insufficient' => [
            TRUE,
            [
                $root => '2G',
                $vendor => '4G',
                'temp' => '1M',
            ],
            [
                ValidationResult::createError([
                    $temp_insufficient,
                ]),
            ],
        ],
        'shared, root and temp insufficient, vendor sufficient' => [
            TRUE,
            [
                $root => '1M',
                $vendor => '2G',
                'temp' => '2M',
            ],
            [
                ValidationResult::createError([
                    $root_insufficient,
                    $temp_insufficient,
                ], $summary),
            ],
        ],
        'not shared, root insufficient, vendor and temp sufficient' => [
            FALSE,
            [
                $root => '5M',
                $vendor => '1G',
                'temp' => '4G',
            ],
            [
                ValidationResult::createError([
                    $root_insufficient,
                ]),
            ],
        ],
        'not shared, vendor insufficient, root and temp sufficient' => [
            FALSE,
            [
                $root => '2G',
                $vendor => '10M',
                'temp' => '4G',
            ],
            [
                ValidationResult::createError([
                    $vendor_insufficient,
                ]),
            ],
        ],
        'not shared, root and vendor sufficient, temp insufficient' => [
            FALSE,
            [
                $root => '1G',
                $vendor => '2G',
                'temp' => '3M',
            ],
            [
                ValidationResult::createError([
                    $temp_insufficient,
                ]),
            ],
        ],
        'not shared, root and vendor insufficient, temp sufficient' => [
            FALSE,
            [
                $root => '500M',
                $vendor => '75M',
                'temp' => '2G',
            ],
            [
                ValidationResult::createError([
                    $root_insufficient,
                    $vendor_insufficient,
                ], $summary),
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.