3 namespace Drupal\Tests\rest\Kernel\Views;
5 use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
8 * Tests the auth option of rest exports.
10 * @coversDefaultClass \Drupal\rest\Plugin\views\display\RestExport
14 class RestExportAuthTest extends ViewsKernelTestBase {
19 public static $modules = [
32 public static $testViews = ['rest_export_with_authorization_correction'];
37 protected function setUp($import_test_views = TRUE) {
38 parent::setUp($import_test_views);
40 $this->installConfig(['user']);
44 * Ensures that rest export auth settings are automatically corrected.
46 * @see rest_update_8401()
47 * @see rest_views_presave()
48 * @see \Drupal\Tests\rest\Functional\Update\RestExportAuthCorrectionUpdateTest
50 public function testAuthCorrection() {
51 // Get particular view.
52 $view = \Drupal::entityTypeManager()
54 ->load('rest_export_with_authorization_correction');
55 $displays = $view->get('display');
56 $this->assertSame($displays['rest_export_1']['display_options']['auth'], ['cookie'], 'Cookie is used for authentication');