class TestDiskSpaceValidator

A test version of the disk space validator to bypass system-level functions.

Hierarchy

  • class \Drupal\Tests\package_manager\Kernel\TestDiskSpaceValidator extends \Drupal\package_manager\Validator\DiskSpaceValidator

Expanded class hierarchy of TestDiskSpaceValidator

File

core/modules/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php, line 481

Namespace

Drupal\Tests\package_manager\Kernel
View source
class TestDiskSpaceValidator extends DiskSpaceValidator {
    
    /**
     * Whether the root and vendor directories are on the same logical disk.
     *
     * @var bool
     */
    public $sharedDisk = TRUE;
    
    /**
     * The amount of free space, keyed by path.
     *
     * @var float[]
     */
    public $freeSpace = [];
    
    /**
     * {@inheritdoc}
     */
    protected function stat(string $path) : array {
        return [
            'dev' => $this->sharedDisk ? 'disk' : uniqid(),
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    protected function freeSpace(string $path) : float {
        return $this->freeSpace[$path];
    }
    
    /**
     * {@inheritdoc}
     */
    public function temporaryDirectory() : string {
        return 'temp';
    }

}

Members

Title Sort descending Modifiers Object type Summary
TestDiskSpaceValidator::$freeSpace public property The amount of free space, keyed by path.
TestDiskSpaceValidator::$sharedDisk public property Whether the root and vendor directories are on the same logical disk.
TestDiskSpaceValidator::freeSpace protected function
TestDiskSpaceValidator::stat protected function
TestDiskSpaceValidator::temporaryDirectory public function

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