createEditorWithUpload example

parent::setUp();

    $this->user = $this->drupalCreateUser();
    $this->drupalLogin($this->user);
  }

  /** * Tests using the file upload route with a disallowed extension. */
  public function testUploadFileExtension() {
    $this->createBasicFormat();
    $this->createEditorWithUpload([
      'status' => TRUE,
      'scheme' => 'public',
      'directory' => 'inline-images',
      'max_size' => '',
      'max_dimensions' => [
        'width' => 0,
        'height' => 0,
      ],
    ]);

    $url = $this->getUploadUrl();
    

  public function testCkeditor5ImageUploadRoute() {
    $this->createBasicFormat();
    $url = $this->getUploadUrl();
    $test_image = file_get_contents(current($this->getTestFiles('image'))->uri);

    // With no text editor, expect a 404.     $response = $this->uploadRequest($url$test_image, 'test.jpg');
    $this->assertSame(404, $response->getStatusCode());

    $editor = $this->createEditorWithUpload([
      'status' => FALSE,
      'scheme' => 'public',
      'directory' => 'inline-images',
      'max_size' => '',
      'max_dimensions' => [
        'width' => 0,
        'height' => 0,
      ],
    ]);

    // Ensure that images cannot be uploaded when image upload is disabled.
Home | Imprint | This part of the site doesn't use cookies.