Commit 47233911 authored by Dries's avatar Dries

Issue #1938892 by JohnAlbin, Pancho: Fixed Switch from ISO-3166-1 country data...

Issue #1938892 by JohnAlbin, Pancho: Fixed Switch from ISO-3166-1 country data to CLDR unicode data.
parent 6f29144a
<?php
/**
* @file
* Contains \Drupal\views\Tests\Plugin\argument_default\RawTest.
*/
namespace Drupal\views\Tests\Plugin\argument_default;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\argument_default\Raw;
use Symfony\Component\HttpFoundation\Request;
/**
* Tests the raw argument default plugin.
*
* @see \Drupal\views\Plugin\views\argument_default\Raw
*/
class RawTest extends UnitTestCase {
public static function getInfo() {
return array(
'name' => 'Argument default: Raw',
'description' => 'Tests the raw argument default plugin.',
'group' => 'Views Plugin',
);
}
/**
* Test the getArgument() method.
*
* @see \Drupal\views\Plugin\views\argument_default\Raw::getArgument()
*/
public function testGetArgument() {
$view = $this->getMockBuilder('Drupal\views\ViewExecutable')
->disableOriginalConstructor()
->getMock();
$display_plugin = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
->disableOriginalConstructor()
->getMock();
$request = new Request(array(), array(), array('system_path' => 'test/example'));
$alias_manager = $this->getMock('Drupal\Core\Path\AliasManagerInterface');
$alias_manager->expects($this->never())
->method('getPathAlias');
// Don't use aliases.
$raw = new Raw(array(), 'raw', array(), $request, $alias_manager);
$options = array(
'use_alias' => FALSE,
'index' => 0,
);
$raw->init($view, $display_plugin, $options);
$this->assertEquals('test', $raw->getArgument());
$raw = new Raw(array(), 'raw', array(), $request, $alias_manager);
$options = array(
'use_alias' => FALSE,
'index' => 1,
);
$raw->init($view, $display_plugin, $options);
$this->assertEquals('example', $raw->getArgument());
// Setup an alias manager with a path alias.
$alias_manager = $this->getMock('Drupal\Core\Path\AliasManagerInterface');
$alias_manager->expects($this->any())
->method('getPathAlias')
->with($this->equalTo('test/example'))
->will($this->returnValue('other/example'));
$raw = new Raw(array(), 'raw', array(), $request, $alias_manager);
$options = array(
'use_alias' => TRUE,
'index' => 0,
);
$raw->init($view, $display_plugin, $options);
$this->assertEquals('other', $raw->getArgument());
$raw = new Raw(array(), 'raw', array(), $request, $alias_manager);
$options = array(
'use_alias' => TRUE,
'index' => 1,
);
$raw->init($view, $display_plugin, $options);
$this->assertEquals('example', $raw->getArgument());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment