Issue #3028708 by Mile23: Deprecate simpletest_generate_file()
parent
1be0372d40
commit
a99b54f992
|
|
@ -565,8 +565,14 @@ function simpletest_classloader_register() {
|
|||
*
|
||||
* @return string
|
||||
* The name of the file, including the path.
|
||||
*
|
||||
* @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
|
||||
* \Drupal\Tests\TestFileCreationTrait::generateFile() instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/3077768
|
||||
*/
|
||||
function simpletest_generate_file($filename, $width, $lines, $type = 'binary-text') {
|
||||
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Tests\TestFileCreationTrait::generateFile() instead. See https://www.drupal.org/node/3077768', E_USER_DEPRECATED);
|
||||
$text = '';
|
||||
for ($i = 0; $i < $lines; $i++) {
|
||||
// Generate $width - 1 characters to leave space for the "\n" character.
|
||||
|
|
|
|||
|
|
@ -82,4 +82,14 @@ class SimpletestDeprecationTest extends KernelTestBase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedDeprecation simpletest_generate_file() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Tests\TestFileCreationTrait::generateFile() instead. See https://www.drupal.org/node/3077768
|
||||
*/
|
||||
public function testDeprecatedSimpletestGenerateFile() {
|
||||
$file = simpletest_generate_file('foo', 40, 10);
|
||||
$public_file = 'public://' . $file . '.txt';
|
||||
$this->assertFileExists($public_file);
|
||||
$this->assertTrue(unlink($public_file));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue