diff --git a/core/modules/views/src/Tests/ModuleTest.php b/core/modules/views/src/Tests/ModuleTest.php index 1f52a19..9d4b1d1 100644 --- a/core/modules/views/src/Tests/ModuleTest.php +++ b/core/modules/views/src/Tests/ModuleTest.php @@ -23,7 +23,7 @@ class ModuleTest extends ViewUnitTestBase { * * @var array */ - public static $testViews = array('test_view_status', 'test_view'); + public static $testViews = array('test_view_status', 'test_view', 'test_argument'); /** * Modules to enable. @@ -269,6 +269,18 @@ public function testViewsPluginList() { } /** + * Tests views.module: views_embed_view(). + */ + public function testViewsEmbedView() { + \Drupal::moduleHandler()->install(array('user')); + $result = views_embed_view('test_argument'); + $this->assertEqual(count($result['#view']->result), 5); + + $result = views_embed_view('test_argument', 'default', 1); + $this->assertEqual(count($result['#view']->result), 1); + } + + /** * Helper to return an expected views option array. * * @param array $views diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index c5eda99..406a892 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -439,7 +439,7 @@ public function save() { * but possibly from elsewhere. */ public function setArguments($args) { - $this->args = $args; + $this->args = array_values($args); } /** diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument.yml new file mode 100644 index 0000000..39ca73f --- /dev/null +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument.yml @@ -0,0 +1,86 @@ +base_table: views_test_data +core: '8' +description: '' +status: '1' +display: + default: + display_options: + defaults: + fields: '0' + pager: '0' + pager_options: '0' + sorts: '0' + arguments: '0' + fields: + age: + field: age + id: age + relationship: none + table: views_test_data + provider: views_test_data + id: + field: id + id: id + relationship: none + table: views_test_data + provider: views_test_data + name: + field: name + id: name + relationship: none + table: views_test_data + provider: views_test_data + pager: + options: + offset: '0' + type: none + pager_options: { } + sorts: + id: + field: id + id: id + order: ASC + relationship: none + table: views_test_data + provider: views_test_data + arguments: + id: + default_action: ignore + style_plugin: default_summary + style_options: { } + wildcard: all + wildcard_substitution: All + title: '' + default_argument_type: fixed + default_argument: '' + validate: + type: none + fail: 'not found' + break_phrase: '0' + not: '0' + id: id + table: views_test_data + field: id + relationship: none + default_options_div_prefix: '' + default_argument_user: '0' + default_argument_fixed: '' + default_argument_php: '' + validate_argument_node_type: + page: '0' + story: '0' + validate_argument_node_access: '0' + validate_argument_nid_type: nid + validate_argument_vocabulary: { } + validate_argument_type: tid + validate_argument_transform: '0' + validate_user_restrict_roles: '0' + validate_argument_php: '' + provider: views_test_data + display_plugin: default + display_title: Master + id: default + position: 0 +label: '' +id: test_argument +tag: ''