Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / views / tests / src / Kernel / ViewExecutableTest.php
index 73902140520ce3f11073a8649efaaa1260cbf803..cb548c0afbaf34880a4f28ec187babe9e00bbb23 100644 (file)
@@ -38,7 +38,7 @@ class ViewExecutableTest extends ViewsKernelTestBase {
    *
    * @var array
    */
-  public static $testViews = ['test_destroy', 'test_executable_displays'];
+  public static $testViews = ['test_destroy', 'test_executable_displays', 'test_argument_dependency'];
 
   /**
    * Properties that should be stored in the configuration.
@@ -136,7 +136,7 @@ class ViewExecutableTest extends ViewsKernelTestBase {
     // Test the initStyle() method.
     $view->initStyle();
     $this->assertTrue($view->style_plugin instanceof DefaultStyle, 'Make sure a reference to the style plugin is set.');
-    // Test the plugin has been inited and view have references to the view and
+    // Test the plugin has been invited and view have references to the view and
     // display handler.
     $this->assertEqual(spl_object_hash($view->style_plugin->view), $view_hash);
     $this->assertEqual(spl_object_hash($view->style_plugin->displayHandler), $display_hash);
@@ -525,4 +525,19 @@ class ViewExecutableTest extends ViewsKernelTestBase {
     $this->assertEquals($nid_definition_before->getPropertyDefinitions(), $nid_definition_after->getPropertyDefinitions());
   }
 
+  /**
+   * Tests if argument overrides by validators are propagated to tokens.
+   */
+  public function testArgumentValidatorValueOverride() {
+    $view = Views::getView('test_argument_dependency');
+    $view->setDisplay('page_1');
+    $view->setArguments(['1', 'this value should be replaced']);
+    $view->execute();
+    $expected = [
+      '{{ arguments.uid }}' => '1',
+      '{{ raw_arguments.uid }}' => '1',
+    ];
+    $this->assertEquals($expected, $view->build_info['substitutions']);
+  }
+
 }