You are here

public function FileTest::testBasicPull in Entity Share 8.2

Same name and namespace in other branches
  1. 8.3 modules/entity_share_client/tests/src/Functional/FileTest.php \Drupal\Tests\entity_share_client\Functional\FileTest::testBasicPull()

Test basic pull feature.

1 method overrides FileTest::testBasicPull()
FileDeletedTest::testBasicPull in modules/entity_share_client/tests/src/Functional/FileDeletedTest.php
Test basic pull feature.

File

modules/entity_share_client/tests/src/Functional/FileTest.php, line 300

Class

FileTest
Functional test class for file field.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

public function testBasicPull() {
  foreach (static::$filesData as $file_data) {
    $this
      ->assertFalse(file_exists($file_data['uri']), 'The physical file ' . $file_data['filename'] . ' has been deleted.');
  }
  $this
    ->pullEveryChannels();
  $this
    ->checkCreatedEntities();
  foreach (static::$filesData as $file_uuid => $file_data) {
    $this
      ->assertTrue(file_exists($file_data['uri']), 'The physical file ' . $file_data['filename'] . ' has been pulled and recreated.');
    if (isset($file_data['file_content'])) {
      $recreated_file_data = file_get_contents($file_data['uri']);
      $this
        ->assertEquals($file_data['file_content'], $recreated_file_data, 'The recreated physical file ' . $file_data['filename'] . ' has the same content.');
    }
    if (isset($this->filesSize[$file_uuid])) {
      $this
        ->assertEquals($this->filesSize[$file_uuid], filesize($file_data['uri']), 'The recreated physical file ' . $file_data['filename'] . ' has the same size has the original.');
    }
  }
}