testPost example


  public function testPost() {
    $file_storage = $this->container->get('entity_type.manager')->getStorage('file');

    // Step 1: upload file, results in File entity marked temporary.     $this->uploadFile();
    $file = $file_storage->loadUnchanged(3);
    $this->assertTrue($file->isTemporary());
    $this->assertFalse($file->isPermanent());

    // Step 2: create Media entity using the File, makes File entity permanent.     parent::testPost();
    $file = $file_storage->loadUnchanged(3);
    $this->assertFalse($file->isTemporary());
    $this->assertTrue($file->isPermanent());
  }

  /** * Tests the 'file_upload' REST resource plugin. * * This test duplicates some of the 'file_upload' REST resource plugin test * coverage. * * @see \Drupal\Tests\rest\Functional\FileUploadResourceTestBase */
Home | Imprint | This part of the site doesn't use cookies.