Commit 4679e821 authored by catch's avatar catch
Browse files

Issue #3368789 by andypost: Fix MaximumFileSizeExceededUploadTest test for PHP 8.3

(cherry picked from commit 8b28900d)
parent d842b8d2
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ protected function setUp(): void {
    $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);

    // Attach a file field to the node type.
    $field_settings = ['file_extensions' => 'txt'];
    $field_settings = ['file_extensions' => 'bin txt'];
    $this->createFileField('field_file', 'node', 'article', [], $field_settings);

    // Log in as a content author who can create Articles.
@@ -100,7 +100,11 @@ public function testUploadFileExceedingMaximumFileSize() {

    // Create a test file that exceeds the maximum POST size with 1 kilobyte.
    $post_max_size = Bytes::toNumber(ini_get('post_max_size'));
    $invalid_file = $this->generateFile('exceeding_post_max_size', ceil(($post_max_size + 1024) / 1024), 1024);
    $invalid_file = 'public://exceeding_post_max_size.bin';
    $file = fopen($invalid_file, 'wb');
    fseek($file, $post_max_size + 1024);
    fwrite($file, 0x0);
    fclose($file);

    // Go to the node creation form and try to upload the test file.
    $this->drupalGet('node/add/article');