diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7655c5f..fc260e6a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,11 @@ name: Test LocalGov Drupal Alert Banner on: push: - branches: [ master ] + branches: + - '1.x' pull_request: - branches: [ master ] + branches: + - '1.x' jobs: @@ -12,39 +14,63 @@ jobs: name: Install LocalGov Drupal runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - localgov-version: "1.x" + drupal-version: "~8.9" + php-version: "7.4" + - localgov-version: "2.x" + drupal-version: "~9.1" + php-version: "7.4" + steps: + - name: Save git branch and git repo names to env if this is not a pull request + if: github.event_name != 'pull_request' + run: | + echo "GIT_BASE=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + echo "GIT_REPO=${GITHUB_REPOSITORY}" >> $GITHUB_ENV + + - name: Save git branch and git repo names to env if this is a pull request + if: github.event_name == 'pull_request' + run: | + echo "GIT_BASE=${GITHUB_BASE_REF}" >> $GITHUB_ENV + echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV + echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + + - name: Set composer branch reference for main version branches + if: endsWith(github.ref, '.x') + run: echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV + + - name: Set composer branch reference for main version branches + if: endsWith(github.ref, '.x') == false + run: echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV + - name: Cached workspace uses: actions/cache@v2 with: path: ./html - key: ${{ runner.os }}-localgov-build-${{ github.run_id }} + key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }} - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: ${{ matrix.php-version }} - name: Clone drupal_container uses: actions/checkout@v2 with: repository: localgovdrupal/drupal-container - ref: master + ref: php${{ matrix.php-version }} - name: Create LocalGov Drupal project - run: composer create-project --stability dev localgovdrupal/localgov-project ./html - - - name: Save git branch and git repo names to env if this is not a pull request - if: github.event_name != 'pull_request' - run: | - echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV - echo "GIT_REPO=${GITHUB_REPOSITORY}" >> $GITHUB_ENV - - - name: Save git branch and git repo names to env if this is a pull request - if: github.event_name == 'pull_request' run: | - echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV - echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + composer create-project --stability dev --no-install localgovdrupal/localgov-project ./html "${{ matrix.localgov-version }}" + composer require --no-install drupal/core-recommended:${{ matrix.drupal-version }} drupal/core-composer-scaffold:${{ matrix.drupal-version }} drupal/core-project-message:${{ matrix.drupal-version }} drupal/core-dev:${{ matrix.drupal-version }} + composer install - name: Setup package source and authentication for the test target run: | @@ -52,22 +78,33 @@ jobs: composer global config github-oauth.github.com ${{ github.token }} - name: Obtain the test target from the repo that triggered this workflow - run: composer --working-dir=html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"dev-${GIT_BRANCH} as 1.0.x-dev" + run: composer --working-dir=html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"${COMPOSER_REF} as ${GIT_BASE%'.x'}" phpcs: name: Coding standards checks needs: build runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - localgov-version: "1.x" + drupal-version: "~8.9" + php-version: "7.4" + - localgov-version: "2.x" + drupal-version: "~9.1" + php-version: "7.4" + steps: - name: Cached workspace uses: actions/cache@v2 with: path: ./html - key: ${{ runner.os }}-localgov-build-${{ github.run_id }} + key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }} restore-keys: | - ${{ runner.os }}-localgov-build- + localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}- - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -84,15 +121,26 @@ jobs: needs: build runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - localgov-version: "1.x" + drupal-version: "~8.9" + php-version: "7.4" + - localgov-version: "2.x" + drupal-version: "~9.1" + php-version: "7.4" + steps: - name: Cached workspace uses: actions/cache@v2 with: path: ./html - key: ${{ runner.os }}-localgov-build-${{ github.run_id }} + key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }} restore-keys: | - ${{ runner.os }}-localgov-build- + localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}- - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -109,6 +157,17 @@ jobs: needs: build runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - localgov-version: "1.x" + drupal-version: "~8.9" + php-version: "7.4" + - localgov-version: "2.x" + drupal-version: "~9.1" + php-version: "7.4" + steps: - name: Clone drupal_container @@ -121,9 +180,9 @@ jobs: uses: actions/cache@v2 with: path: ./html - key: ${{ runner.os }}-localgov-build-${{ github.run_id }} + key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }} restore-keys: | - ${{ runner.os }}-localgov-build- + localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}- - name: Start Docker environment run: docker-compose -f docker-compose.yml up -d diff --git a/localgov_alert_banner.services.yml b/localgov_alert_banner.services.yml deleted file mode 100644 index ee542550..00000000 --- a/localgov_alert_banner.services.yml +++ /dev/null @@ -1,5 +0,0 @@ -services: - localgov_alert_banner.route_subscriber: - class: Drupal\localgov_alert_banner\Routing\AlertBannerRouteSubscriber - tags: - - { name: event_subscriber } diff --git a/src/AlertBannerEntityListBuilder.php b/src/AlertBannerEntityListBuilder.php index a1ce7b77..1c13042f 100644 --- a/src/AlertBannerEntityListBuilder.php +++ b/src/AlertBannerEntityListBuilder.php @@ -26,7 +26,7 @@ public function buildHeader() { * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { - /* @var \Drupal\localgov_alert_banner\Entity\AlertBannerEntity $entity */ + /** @var \Drupal\localgov_alert_banner\Entity\AlertBannerEntity $entity */ $row['id'] = $entity->id(); $row['title'] = Link::createFromRoute( $entity->label(), diff --git a/src/Controller/AlertBannerEntityController.php b/src/Controller/AlertBannerEntityController.php index 58dc58e5..00cb4067 100644 --- a/src/Controller/AlertBannerEntityController.php +++ b/src/Controller/AlertBannerEntityController.php @@ -94,8 +94,15 @@ public function revisionOverview(AlertBannerEntityInterface $localgov_alert_bann $languages = $localgov_alert_banner->getTranslationLanguages(); $type_id = $localgov_alert_banner->bundle(); $has_translations = (count($languages) > 1); - $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $localgov_alert_banner->label()]) : $this->t('Revisions for %title', ['%title' => $localgov_alert_banner->label()]); - + if ($has_translations) { + $build['#title'] = $this->t('@langname revisions for %title', [ + '@langname' => $langname, + '%title' => $localgov_alert_banner->label(), + ]); + } + else { + $build['#title'] = $this->t('Revisions for %title', ['%title' => $localgov_alert_banner->label()]); + } $header = [$this->t('Revision'), $this->t('Operations')]; $revert_permission = (($account->hasPermission("manage all localgov alert banner entities") || $account->hasPermission('manage localgov alert banner ' . $type_id . ' entities'))); $delete_permission = (($account->hasPermission("manage all localgov alert banner entities") || $account->hasPermission('manage localgov alert banner ' . $type_id . ' entities'))); diff --git a/src/Form/AlertBannerEntityRevisionDeleteForm.php b/src/Form/AlertBannerEntityRevisionDeleteForm.php index 6b5dd954..edad52ca 100644 --- a/src/Form/AlertBannerEntityRevisionDeleteForm.php +++ b/src/Form/AlertBannerEntityRevisionDeleteForm.php @@ -99,8 +99,14 @@ public function buildForm(array $form, FormStateInterface $form_state, $localgov public function submitForm(array &$form, FormStateInterface $form_state) { $this->AlertBannerEntityStorage->deleteRevision($this->revision->getRevisionId()); - $this->logger('content')->notice('Alert banner: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - $this->messenger()->addMessage($this->t('Revision from %revision-date of Alert banner %title has been deleted.', ['%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); + $this->logger('content')->notice('Alert banner: deleted %title revision %revision.', [ + '%title' => $this->revision->label(), + '%revision' => $this->revision->getRevisionId(), + ]); + $this->messenger()->addMessage($this->t('Revision from %revision-date of Alert banner %title has been deleted.', [ + '%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime()), + '%title' => $this->revision->label(), + ])); $form_state->setRedirect( 'entity.localgov_alert_banner.canonical', ['localgov_alert_banner' => $this->revision->id()] diff --git a/src/Form/AlertBannerEntitySettingsForm.php b/src/Form/AlertBannerEntitySettingsForm.php index faff0e56..78df63e5 100644 --- a/src/Form/AlertBannerEntitySettingsForm.php +++ b/src/Form/AlertBannerEntitySettingsForm.php @@ -6,7 +6,7 @@ use Drupal\Core\Form\FormStateInterface; /** - * Class AlertBannerEntitySettingsForm. + * Provides a form for managing alert banner settings. * * @ingroup localgov_alert_banner */ diff --git a/src/Form/AlertBannerEntityTypeForm.php b/src/Form/AlertBannerEntityTypeForm.php index df95a62a..59498fc4 100644 --- a/src/Form/AlertBannerEntityTypeForm.php +++ b/src/Form/AlertBannerEntityTypeForm.php @@ -6,7 +6,7 @@ use Drupal\Core\Form\FormStateInterface; /** - * Class AlertBannerEntityTypeForm. + * Provides a form for edting alert banner types. */ class AlertBannerEntityTypeForm extends EntityForm { diff --git a/src/Routing/AlertBannerRouteSubscriber.php b/src/Routing/AlertBannerRouteSubscriber.php deleted file mode 100644 index 36cf44eb..00000000 --- a/src/Routing/AlertBannerRouteSubscriber.php +++ /dev/null @@ -1,25 +0,0 @@ -get('entity.alert_banner.canonical')) { - // Change the access permission for the alert banner access page. - $route->setRequirement('_custom_access', 'localgov_alert_banner.alert_banner_entity_page_access::access'); - } - - } - -} diff --git a/tests/src/Functional/AdminViewTest.php b/tests/src/Functional/AdminViewTest.php index ca74d875..4bfc47d5 100644 --- a/tests/src/Functional/AdminViewTest.php +++ b/tests/src/Functional/AdminViewTest.php @@ -19,7 +19,7 @@ class AdminViewTest extends BrowserTestBase { /** * {@inheritdoc} */ - public static $modules = [ + protected static $modules = [ 'localgov_alert_banner', ]; @@ -33,16 +33,16 @@ public function testLoadAdminView() { // Check can access the admin view dashboard. $this->drupalGet('admin/content/alert-banner'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); // Check this is the view by making sure certian view only text is present. // @todo Work out how to make sure this is the view path (Kernal test?). - $this->assertRaw('Manage Alert Banners'); + $this->assertSession()->responseContains('Manage Alert Banners'); // Check that loading the collection URL loads the admin dashboard. $collectionUrl = Url::fromRoute('entity.localgov_alert_banner.collection'); $this->drupalGet($collectionUrl); - $this->assertUrl('admin/content/alert-banner'); + $this->assertSession()->addressEquals('admin/content/alert-banner'); } } diff --git a/tests/src/Functional/AlertBannerBlockTest.php b/tests/src/Functional/AlertBannerBlockTest.php index f89bb064..398bdc11 100644 --- a/tests/src/Functional/AlertBannerBlockTest.php +++ b/tests/src/Functional/AlertBannerBlockTest.php @@ -18,7 +18,7 @@ class AlertBannerBlockTest extends BrowserTestBase { /** * {@inheritdoc} */ - public static $modules = [ + protected static $modules = [ 'block', 'path', 'options', diff --git a/tests/src/Functional/AlertConfirmationTest.php b/tests/src/Functional/AlertConfirmationTest.php index 594c50d5..c2b0f2ef 100644 --- a/tests/src/Functional/AlertConfirmationTest.php +++ b/tests/src/Functional/AlertConfirmationTest.php @@ -20,14 +20,14 @@ class AlertConfirmationTest extends BrowserTestBase { /** * {@inheritdoc} */ - public static $modules = [ + protected static $modules = [ 'localgov_alert_banner', ]; /** * {@inheritdoc} */ - public function setUp() { + public function setUp(): void { parent::setUp(); $emergencyPublisherUser = $this->createUser(); @@ -84,9 +84,8 @@ public function testAlertConfirmation() { // Go to the alert confirmation page, tick the unpublish others. // Verifiy that the alert 2 banner is unpublished. - $this->drupalPostForm($alert->toUrl('status-form')->toString(), [ - 'edit-unpublish-others' => 1, - ], 'Confirm'); + $this->drupalGet($alert->toUrl('status-form')->toString()); + $this->submitForm(['edit-unpublish-others' => 1], 'Confirm'); // Check for the presence of the Put banner live link. $this->drupalGet($alert_2->toUrl('canonical')->toString()); @@ -94,9 +93,8 @@ public function testAlertConfirmation() { // Go to the second alert confirmation page, do not unpublih others. // Verifiy that the alert banner remains published. - $this->drupalPostForm($alert_2->toUrl('status-form')->toString(), [ - 'edit-unpublish-others' => 0, - ], 'Confirm'); + $this->drupalGet($alert_2->toUrl('status-form')->toString()); + $this->submitForm(['edit-unpublish-others' => 0], 'Confirm'); // Check for the presence of the Remove banner link. $this->drupalGet($alert->toUrl('canonical')->toString()); @@ -125,7 +123,8 @@ public function testSaveAlertRedirect() { $form_vars = [ 'status-change' => 1, ]; - $this->drupalPostForm($edit_url, $form_vars, 'Save'); + $this->drupalGet($edit_url); + $this->submitForm($form_vars, 'Save'); $this->assertSession()->addressEquals($alert->toUrl('status-form')->toString()); $this->getSession()->getPage()->pressButton('Confirm'); @@ -135,7 +134,8 @@ public function testSaveAlertRedirect() { $form_vars = [ 'status-change' => 1, ]; - $this->drupalPostForm($edit_url, $form_vars, 'Save'); + $this->drupalGet($edit_url); + $this->submitForm($form_vars, 'Save'); $this->assertSession()->addressEquals($alert->toUrl('status-form')->toString()); $this->getSession()->getPage()->pressButton('Confirm'); @@ -145,7 +145,8 @@ public function testSaveAlertRedirect() { $form_vars = [ 'status-change' => 0, ]; - $this->drupalPostForm($edit_url, $form_vars, 'Save'); + $this->drupalGet($edit_url); + $this->submitForm($form_vars, 'Save'); $this->assertSession()->addressNotEquals($alert->toUrl('status-form')->toString()); // Change the status of the banner with a destination paremeter and verify @@ -159,7 +160,8 @@ public function testSaveAlertRedirect() { $form_vars = [ 'status-change' => 1, ]; - $this->drupalPostForm($edit_url, $form_vars, 'Save', $options); + $this->drupalGet($edit_url, $options); + $this->submitForm($form_vars, 'Save'); $this->assertSession()->addressEquals($alert->toUrl('status-form')->toString()); $this->getSession()->getPage()->pressButton('Confirm'); $this->assertSession()->addressEquals('/admin'); diff --git a/tests/src/Functional/PermissionsTest.php b/tests/src/Functional/PermissionsTest.php index d74f9c73..446a6bca 100644 --- a/tests/src/Functional/PermissionsTest.php +++ b/tests/src/Functional/PermissionsTest.php @@ -18,14 +18,14 @@ class PermissionsTest extends BrowserTestBase { /** * {@inheritdoc} */ - public static $modules = [ + protected static $modules = [ 'localgov_alert_banner', ]; /** * {@inheritdoc} */ - public function setUp() { + public function setUp(): void { parent::setUp(); @@ -51,50 +51,50 @@ public function testAlertBannerUserAccess() { // Check that anonymous user cannot access to the overview page. $this->drupalGet('admin/content/alert-banner'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); // Check that anonymous user does not have CRUD page access. $this->drupalGet('admin/content/alert-banner/add/localgov_alert_banner'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); $this->drupalGet('admin/content/alert-banner/1/edit'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); $this->drupalGet('admin/content/alert-banner/1/revisions'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); $this->drupalGet('admin/content/alert-banner/1/delete'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); // Check that anonymous user cannot view the alert banner main page. $this->drupalGet('admin/content/alert-banner/1'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); // Check that anonymous user cannot access the alert banner types. $this->drupalGet('admin/structure/alert-banner-types/localgov_alert_banner_type'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); $normalAdminUser = $this->createUser(['access administration pages']); $this->drupalLogin($normalAdminUser); // Check that authenticated user cannot access to the overview page. $this->drupalGet('admin/content/alert-banner'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); // Check that authenticated user does not have CRUD page access. $this->drupalGet('admin/content/alert-banner/add/localgov_alert_banner'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); $this->drupalGet('admin/content/alert-banner/1/edit'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); $this->drupalGet('admin/content/alert-banner/1/revisions'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); $this->drupalGet('admin/content/alert-banner/1/delete'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); // Check that authenticated user cannot view the alert banner main page. $this->drupalGet('admin/content/alert-banner/1'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); // Check that authenticated user cannot access the alert banner types. $this->drupalGet('admin/structure/alert-banner-types/localgov_alert_banner_type'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); $this->drupalLogout(); @@ -105,25 +105,25 @@ public function testAlertBannerUserAccess() { // Check that emergency publisher user has access to the overview page. $this->drupalGet('admin/content/alert-banner'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); // Check that emergency publisher user has CRUD page access. $this->drupalGet('admin/content/alert-banner/add/localgov_alert_banner'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); $this->drupalGet('admin/content/alert-banner/1/edit'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); $this->drupalGet('admin/content/alert-banner/1/revisions'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); $this->drupalGet('admin/content/alert-banner/1/delete'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); // Check that emergency publisher user can view the alert banner main page. $this->drupalGet('admin/content/alert-banner/1'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); // Check that emergency publisher user cannot access the alert banner types. $this->drupalGet('admin/structure/alert-banner-types/localgov_alert_banner_type'); - $this->assertResponse(Response::HTTP_FORBIDDEN); + $this->assertSession()->statusCodeEquals(Response::HTTP_FORBIDDEN); $this->drupalLogout(); @@ -138,21 +138,21 @@ public function testAlertBannerUserAccess() { // Check that emergency publisher user has access to the overview page. $this->drupalGet('admin/content/alert-banner'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); // Check that emergency publisher user has CRUD page access. $this->drupalGet('admin/content/alert-banner/add/localgov_alert_banner'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); $this->drupalGet('admin/content/alert-banner/1/edit'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); $this->drupalGet('admin/content/alert-banner/1/revisions'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); $this->drupalGet('admin/content/alert-banner/1/delete'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); // Check that emergency publisher user can view the alert banner main page. $this->drupalGet('admin/content/alert-banner/1'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); $this->drupalLogout(); @@ -165,7 +165,7 @@ public function testAlertBannerUserAccess() { // Check that the admin user can access the alert banner types. $this->drupalGet('admin/structure/alert-banner-types/localgov_alert_banner_type'); - $this->assertResponse(Response::HTTP_OK); + $this->assertSession()->statusCodeEquals(Response::HTTP_OK); } } diff --git a/tests/src/Functional/ViewsStatusLinkTest.php b/tests/src/Functional/ViewsStatusLinkTest.php index bd7d72d6..6537d70b 100644 --- a/tests/src/Functional/ViewsStatusLinkTest.php +++ b/tests/src/Functional/ViewsStatusLinkTest.php @@ -22,7 +22,7 @@ class ViewsStatusLinkTest extends BrowserTestBase { /** * {@inheritdoc} */ - public static $modules = ['localgov_alert_banner']; + protected static $modules = ['localgov_alert_banner']; /** * {@inheritdoc} @@ -32,7 +32,7 @@ class ViewsStatusLinkTest extends BrowserTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $emergencyPublisherUser = $this->createUser(); diff --git a/tests/src/FunctionalJavascript/AlertBannerHideTest.php b/tests/src/FunctionalJavascript/AlertBannerHideTest.php index 230cdf7f..22da97ea 100644 --- a/tests/src/FunctionalJavascript/AlertBannerHideTest.php +++ b/tests/src/FunctionalJavascript/AlertBannerHideTest.php @@ -22,7 +22,7 @@ class AlertBannerHideTest extends WebDriverTestBase { /** * {@inheritdoc} */ - public static $modules = [ + protected static $modules = [ 'localgov_alert_banner', ]; diff --git a/tests/src/Kernel/AlertBannerBlockOrderTest.php b/tests/src/Kernel/AlertBannerBlockOrderTest.php index 10718c7d..599c46c0 100644 --- a/tests/src/Kernel/AlertBannerBlockOrderTest.php +++ b/tests/src/Kernel/AlertBannerBlockOrderTest.php @@ -18,7 +18,7 @@ class AlertBannerBlockOrderTest extends KernelTestBase { * * @var array */ - public static $modules = [ + protected static $modules = [ 'system', 'field', 'text', @@ -33,7 +33,7 @@ class AlertBannerBlockOrderTest extends KernelTestBase { /** * {@inheritdoc} */ - public function setUp() { + public function setUp(): void { parent::setup(); $this->installEntitySchema('user');