Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/rocksensor1/web/core/modules/file/tests/src/Kernel/Views/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/rocksensor1/web/core/modules/file/tests/src/Kernel/Views/FileViewsFieldAccessTest.php

<?php

declare(strict_types=1);

namespace Drupal\Tests\file\Kernel\Views;

use Drupal\file\Entity\File;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\user\Entity\User;
use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;

/**
 * Tests base field access in Views for the file entity.
 *
 * @group File
 */
class FileViewsFieldAccessTest extends FieldFieldAccessTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['file', 'entity_test', 'language', 'user'];

  /**
   * {@inheritdoc}
   */
  protected function setUp($import_test_views = TRUE): void {
    parent::setUp($import_test_views);

    $this->installEntitySchema('file');
  }

  /**
   * Check access for file fields.
   */
  public function testFileFields(): void {
    ConfigurableLanguage::create([
      'id' => 'fr',
      'label' => 'French',
    ])->save();

    $user = User::create([
      'name' => 'test user',
    ]);
    $user->save();

    file_put_contents('public://test.txt', 'test');
    $file = File::create([
      'filename' => 'test.txt',
      'uri' => 'public://test.txt',
      'status' => TRUE,
      'langcode' => 'fr',
      'uid' => $user->id(),
    ]);
    $file->save();

    // @todo Expand the test coverage in https://www.drupal.org/node/2464635

    $this->assertFieldAccess('file', 'fid', $file->id());
    $this->assertFieldAccess('file', 'uuid', $file->uuid());
    $this->assertFieldAccess('file', 'langcode', $file->language()->getName());
    $this->assertFieldAccess('file', 'uid', 'test user');
    $this->assertFieldAccess('file', 'filename', $file->getFilename());
    $this->assertFieldAccess('file', 'uri', $file->getFileUri());
    $this->assertFieldAccess('file', 'filemime', $file->filemime->value);
    $this->assertFieldAccess('file', 'filesize', '4 bytes');
    $this->assertFieldAccess('file', 'status', 'Permanent');
    // $this->assertFieldAccess('file', 'created', \Drupal::service('date.formatter')->format(123456));
    // $this->assertFieldAccess('file', 'changed', \Drupal::service('date.formatter')->format(\Drupal::time()->getRequestTime()));
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net