X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews%2Fsrc%2FTests%2FViewAjaxTest.php;h=5a966a8f76ba29845e6dff2c9ecb027eda9401e5;hp=b8b2730e6edcbd1da848ffd01d46239e9924408e;hb=bfbba508964731508b9bd6d5835c2edc858db95b;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/web/core/modules/views/src/Tests/ViewAjaxTest.php b/web/core/modules/views/src/Tests/ViewAjaxTest.php index b8b2730e6..5a966a8f7 100644 --- a/web/core/modules/views/src/Tests/ViewAjaxTest.php +++ b/web/core/modules/views/src/Tests/ViewAjaxTest.php @@ -17,7 +17,7 @@ class ViewAjaxTest extends ViewTestBase { * * @var array */ - public static $testViews = ['test_ajax_view']; + public static $testViews = ['test_ajax_view', 'test_view']; protected function setUp() { parent::setUp(); @@ -61,4 +61,14 @@ class ViewAjaxTest extends ViewTestBase { $this->assertEqual(count($result), 2, 'Ensure that two items are rendered in the HTML.'); } + /** + * Ensures that non-ajax view cannot be accessed via an ajax HTTP request. + */ + public function testNonAjaxViewViaAjax() { + $this->drupalPost('views/ajax', '', ['view_name' => 'test_ajax_view', 'view_display_id' => 'default'], ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); + $this->assertResponse(200); + $this->drupalPost('views/ajax', '', ['view_name' => 'test_view', 'view_display_id' => 'default'], ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'drupal_ajax']]); + $this->assertResponse(403); + } + }