You are here

public function EntityFileTest::testIsLocalUri in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Tests/Migrate/EntityFileTest.php \Drupal\file\Tests\Migrate\EntityFileTest::testIsLocalUri()

Tests various invocations of the isLocalUri() method.

File

core/modules/file/src/Tests/Migrate/EntityFileTest.php, line 198
Contains \Drupal\file\Tests\Migrate\EntityFileTest.

Class

EntityFileTest
Tests the entity file destination plugin.

Namespace

Drupal\file\Tests\Migrate

Code

public function testIsLocalUri() {
  $plugin = $this->destination;
  $method = new \ReflectionMethod($plugin, 'isLocalUri');
  $method
    ->setAccessible(TRUE);
  $this
    ->assertTrue($method
    ->invoke($plugin, 'public://foo.txt'));
  $this
    ->assertTrue($method
    ->invoke($plugin, 'public://path/to/foo.txt'));
  $this
    ->assertTrue($method
    ->invoke($plugin, 'temporary://foo.txt'));
  $this
    ->assertTrue($method
    ->invoke($plugin, 'temporary://path/to/foo.txt'));
  $this
    ->assertTrue($method
    ->invoke($plugin, 'foo.txt'));
  $this
    ->assertTrue($method
    ->invoke($plugin, '/path/to/files/foo.txt'));
  $this
    ->assertTrue($method
    ->invoke($plugin, 'relative/path/to/foo.txt'));
  $this
    ->assertFalse($method
    ->invoke($plugin, 'http://www.example.com/foo.txt'));
}