summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries2013-06-28 17:06:15 (GMT)
committerDries2013-06-28 17:06:49 (GMT)
commit472339116c22f20646799e546d72597d34f2f929 (patch)
treeae171ffdf05e23557588f8ceb3a9a66ce0d05da9
parent6f29144a10f863b203a562f534605dab6055c4a0 (diff)
Issue #1938892 by JohnAlbin, Pancho: Fixed Switch from ISO-3166-1 country data to CLDR unicode data.
-rw-r--r--core/modules/views/tests/Drupal/views/Tests/Plugin/argument_default/RawTest.php89
1 files changed, 89 insertions, 0 deletions
diff --git a/core/modules/views/tests/Drupal/views/Tests/Plugin/argument_default/RawTest.php b/core/modules/views/tests/Drupal/views/Tests/Plugin/argument_default/RawTest.php
new file mode 100644
index 0000000..f866575
--- /dev/null
+++ b/core/modules/views/tests/Drupal/views/Tests/Plugin/argument_default/RawTest.php
@@ -0,0 +1,89 @@
+<?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());
+
+ }
+
+}