RestExportAuthTest.php in Drupal 8
File
core/modules/rest/tests/src/Kernel/Views/RestExportAuthTest.php
View source
<?php
namespace Drupal\Tests\rest\Kernel\Views;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
class RestExportAuthTest extends ViewsKernelTestBase {
public static $modules = [
'node',
'rest',
'views_ui',
'basic_auth',
'serialization',
'rest',
'user',
];
public static $testViews = [
'rest_export_with_authorization_correction',
];
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this
->installConfig([
'user',
]);
}
public function testAuthCorrection() {
$view = \Drupal::entityTypeManager()
->getStorage('view')
->load('rest_export_with_authorization_correction');
$displays = $view
->get('display');
$this
->assertSame($displays['rest_export_1']['display_options']['auth'], [
'cookie',
], 'Cookie is used for authentication');
}
}