class SystemFunctionsLegacyTest

Same name and namespace in other branches
  1. 8.9.x core/modules/system/tests/src/Kernel/SystemFunctionsLegacyTest.php \Drupal\Tests\system\Kernel\SystemFunctionsLegacyTest

Tests the deprecations in the system module.

@group system @group legacy

Hierarchy

Expanded class hierarchy of SystemFunctionsLegacyTest

File

core/modules/system/tests/src/Kernel/System/SystemFunctionsLegacyTest.php, line 15

Namespace

Drupal\Tests\system\Kernel\System
View source
class SystemFunctionsLegacyTest extends KernelTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'system',
    // Test system_get_module_admin_tasks() require user.permissions service.
'user',
  ];
  
  /**
   * @covers ::system_time_zones
   */
  public function testSystemTimeZones() : void {
    $this->expectDeprecation('system_time_zones() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. This function is no longer used in Drupal core. Use \\Drupal\\Core\\Datetime\\TimeZoneFormHelper::getOptionsList(), \\Drupal\\Core\\Datetime\\TimeZoneFormHelper::getOptionsListByRegion() or \\DateTimeZone::listIdentifiers() instead. See https://www.drupal.org/node/3023528');
    system_time_zones();
  }
  
  /**
   * @covers ::system_retrieve_file
   */
  public function testSystemRetrieveFile() : void {
    $this->expectDeprecation('system_retrieve_file is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3223362');
    $retrieved_file = system_retrieve_file('http://example.com/foo.txt');
    $this->assertFalse($retrieved_file);
  }
  
  /**
   * Tests system_get_module_admin_tasks() deprecation.
   *
   * @see system_get_module_admin_tasks()
   * @see drupal_static_reset()
   */
  public function testSystemGetModuleAdminTasksDeprecation() : void {
    $this->expectDeprecation("system_get_module_admin_tasks() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use the 'system.module_admin_links_helper' service with the getModuleAdminLinks() method and 'user.module_permissions_link_helper' service with the ::getModulePermissionsLink() method instead. See https://www.drupal.org/node/3038972");
    system_get_module_admin_tasks('foo', 'Foo');
    $this->expectDeprecation("Calling drupal_static_reset() with 'system_get_module_admin_tasks' as an argument is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement for this usage. See https://www.drupal.org/node/3038972");
    drupal_static_reset('system_get_module_admin_tasks');
  }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary
ConfigTestTrait::configImporter protected function Returns a ConfigImporter object to import test configuration.
ConfigTestTrait::copyConfig protected function Copies configuration objects from source storage to target storage.
ExtensionListTestTrait::getModulePath protected function Gets the path for the specified module.
ExtensionListTestTrait::getThemePath protected function Gets the path for the specified theme.
RandomGeneratorTrait::getRandomGenerator protected function Gets the random generator for the utility methods.
RandomGeneratorTrait::randomMachineName protected function Generates a unique random string containing letters and numbers.
RandomGeneratorTrait::randomObject public function Generates a random PHP object.
RandomGeneratorTrait::randomString public function Generates a pseudo-random string of ASCII characters of codes 32 to 126.
RandomGeneratorTrait::randomStringValidate Deprecated public function Callback for random string validation.
StorageCopyTrait::replaceStorageContents protected static function Copy the configuration from one storage to another and remove stale items.
SystemFunctionsLegacyTest::$modules protected static property Modules to install.
SystemFunctionsLegacyTest::testSystemGetModuleAdminTasksDeprecation public function Tests system_get_module_admin_tasks() deprecation.
SystemFunctionsLegacyTest::testSystemRetrieveFile public function @covers ::system_retrieve_file[[api-linebreak]]
SystemFunctionsLegacyTest::testSystemTimeZones public function @covers ::system_time_zones[[api-linebreak]]
TestRequirementsTrait::checkModuleRequirements Deprecated private function Checks missing module requirements.
TestRequirementsTrait::checkRequirements Deprecated protected function Check module requirements for the Drupal use case.
TestRequirementsTrait::getDrupalRoot protected static function Returns the Drupal root directory.

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