You are here

function OpenLayersUnitTests::testOpenLayersStylePath in Openlayers 7.2

File

tests/openlayers.test, line 365
Main OpenLayers Test file

Class

OpenLayersUnitTests
OpenLayers Unit Tests

Code

function testOpenLayersStylePath() {
  module_load_include('inc', 'openlayers', 'includes/openlayers.render');
  global $base_url;

  // Full URL
  $path = 'http://example.org/sites/all/modules/openlayers/example/${path}.jpg';
  $styled_path = openlayers_style_path($path);
  $this
    ->assertTrue($styled_path === $path, 'OpenLayers Style Path function with full URL.');

  // Just replacement value
  $path = '${path}';
  $styled_path = openlayers_style_path($path);
  $this
    ->assertTrue($styled_path === $path, 'OpenLayers Style Path function with just replacement value.');

  // Relative URL
  $path = 'sites/all/modules/openlayers/example/${path}.jpg';
  $styled_path = openlayers_style_path($path);
  $this
    ->assertTrue($styled_path === $base_url . '/' . $path, 'OpenLayers Style Path function with relative URL.');
}