Skip to content

Commit

Permalink
Issue #3153264 by siddhant.bhosale, Hardik_Patel_12, longwave: Remove…
Browse files Browse the repository at this point in the history
… uses of t() in clickViewsOperationLink(), helperButtonHasLabel() and optionExists() calls

(cherry picked from commit 7ad99c1ee870c683a4927ec21188c62aaa2b98e5)
  • Loading branch information
alexpott committed Jul 31, 2020
1 parent 408f827 commit ec77b2e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testSubmitButton() {
// Test the submit button value defaults to 'Apply'.
$this->drupalGet('test_exposed_form_buttons');
$this->assertSession()->statusCodeEquals(200);
$this->helperButtonHasLabel('edit-submit-test-exposed-form-buttons', t('Apply'));
$this->helperButtonHasLabel('edit-submit-test-exposed-form-buttons', 'Apply');

// Rename the label of the submit button.
$view = Views::getView('test_exposed_form_buttons');
Expand All @@ -84,7 +84,7 @@ public function testSubmitButton() {

// Make sure the submit button label shows 'Apply'.
$this->drupalGet('test_exposed_form_buttons');
$this->helperButtonHasLabel('edit-submit-test-exposed-form-buttons', t('Apply'));
$this->helperButtonHasLabel('edit-submit-test-exposed-form-buttons', 'Apply');
}

/**
Expand Down Expand Up @@ -264,7 +264,7 @@ public function testInputRequired() {

$this->drupalGet('test_exposed_form_buttons');
$this->assertSession()->statusCodeEquals(200);
$this->helperButtonHasLabel('edit-submit-test-exposed-form-buttons', t('Apply'));
$this->helperButtonHasLabel('edit-submit-test-exposed-form-buttons', 'Apply');

// Ensure that no results are displayed.
$rows = $this->xpath("//div[contains(@class, 'views-row')]");
Expand Down
20 changes: 10 additions & 10 deletions modules/views_ui/tests/src/Functional/DefaultViewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testDefaultViews() {
// Enable the view, and make sure it is now visible on the main listing
// page.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink(t('Enable'), '/glossary/');
$this->clickViewsOperationLink('Enable', '/glossary/');
$this->assertUrl('admin/structure/views');
$this->assertLinkByHref($edit_href);

Expand Down Expand Up @@ -76,7 +76,7 @@ public function testDefaultViews() {
$this->drupalGet('admin/structure/views');
$this->assertLinkByHref('admin/structure/views/view/archive/enable');
// Enable it again so it can be tested for access permissions.
$this->clickViewsOperationLink(t('Enable'), '/archive/');
$this->clickViewsOperationLink('Enable', '/archive/');

// It should now be possible to revert the view. Do that, and make sure the
// view title we added above no longer is displayed.
Expand All @@ -89,7 +89,7 @@ public function testDefaultViews() {

// Duplicate the view and check that the normal schema of duplicated views is used.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink(t('Duplicate'), '/glossary');
$this->clickViewsOperationLink('Duplicate', '/glossary');
$edit = [
'id' => 'duplicate_of_glossary',
];
Expand All @@ -99,7 +99,7 @@ public function testDefaultViews() {

// Duplicate a view and set a custom name.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink(t('Duplicate'), '/glossary');
$this->clickViewsOperationLink('Duplicate', '/glossary');
$random_name = strtolower($this->randomMachineName());
$this->drupalPostForm(NULL, ['id' => $random_name], t('Duplicate'));
$this->assertUrl("admin/structure/views/view/$random_name", [], 'The custom view name got saved.');
Expand All @@ -109,13 +109,13 @@ public function testDefaultViews() {
// listing page.
// @todo Test this behavior with templates instead.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink(t('Disable'), '/glossary/');
$this->clickViewsOperationLink('Disable', '/glossary/');
// $this->assertUrl('admin/structure/views');
// $this->assertNoLinkByHref($edit_href);
// The easiest way to verify it appears on the disabled views listing page
// is to try to click the "enable" link from there again.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink(t('Enable'), '/glossary/');
$this->clickViewsOperationLink('Enable', '/glossary/');
$this->assertUrl('admin/structure/views');
$this->assertLinkByHref($edit_href);

Expand All @@ -132,7 +132,7 @@ public function testDefaultViews() {
// Test deleting a view.
$this->drupalLogin($this->fullAdminUser);
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink(t('Delete'), '/glossary/');
$this->clickViewsOperationLink('Delete', '/glossary/');
// Submit the confirmation form.
$this->drupalPostForm(NULL, [], t('Delete'));
// Ensure the view is no longer listed.
Expand All @@ -145,15 +145,15 @@ public function testDefaultViews() {

// Delete all duplicated Glossary views.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink(t('Delete'), 'duplicate_of_glossary');
$this->clickViewsOperationLink('Delete', 'duplicate_of_glossary');
// Submit the confirmation form.
$this->drupalPostForm(NULL, [], t('Delete'));

$this->drupalGet('glossary');
$this->assertSession()->statusCodeEquals(200);

$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink(t('Delete'), $random_name);
$this->clickViewsOperationLink('Delete', $random_name);
// Submit the confirmation form.
$this->drupalPostForm(NULL, [], t('Delete'));
$this->drupalGet('glossary');
Expand Down Expand Up @@ -183,7 +183,7 @@ public function testSplitListing() {
$this->assertCount(1, $elements, 'A disabled view is found in the disabled views table.');

// Enable the view.
$this->clickViewsOperationLink(t('Enable'), '/test_view_status/');
$this->clickViewsOperationLink('Enable', '/test_view_status/');

$elements = $this->xpath($xpath, $arguments);
$this->assertCount(0, $elements, 'After enabling a view, it is not found in the disabled views table.');
Expand Down
12 changes: 6 additions & 6 deletions modules/views_ui/tests/src/Functional/ExposedFormUITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testExposedAdminUi() {

$this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/type');
// Be sure that the button is called exposed.
$this->helperButtonHasLabel('edit-options-expose-button-button', t('Expose filter'));
$this->helperButtonHasLabel('edit-options-expose-button-button', 'Expose filter');

// The first time the filter UI is displayed, the operator and the
// value forms should be shown.
Expand All @@ -81,7 +81,7 @@ public function testExposedAdminUi() {
// Click the Expose filter button.
$this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/type', $edit, t('Expose filter'));
// Check the label of the expose button.
$this->helperButtonHasLabel('edit-options-expose-button-button', t('Hide filter'));
$this->helperButtonHasLabel('edit-options-expose-button-button', 'Hide filter');

// After exposing the filter, Operator and Value should be still here.
$this->assertFieldById('edit-options-operator-in', 'in', 'Operator In exists');
Expand All @@ -102,7 +102,7 @@ public function testExposedAdminUi() {

// Now check the sort criteria.
$this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/sort/created');
$this->helperButtonHasLabel('edit-options-expose-button-button', t('Expose sort'));
$this->helperButtonHasLabel('edit-options-expose-button-button', 'Expose sort');
$this->assertNoFieldById('edit-options-expose-label', '', 'Make sure no label field is shown');

// Un-expose the filter.
Expand All @@ -119,7 +119,7 @@ public function testExposedAdminUi() {
$edit = [];
$this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/sort/created', $edit, t('Expose sort'));
// Check the label of the expose button.
$this->helperButtonHasLabel('edit-options-expose-button-button', t('Hide sort'));
$this->helperButtonHasLabel('edit-options-expose-button-button', 'Hide sort');
$this->assertFieldById('edit-options-expose-label', 'Authored on', 'Make sure a label field is shown');

// Test adding a new exposed sort criteria.
Expand Down Expand Up @@ -154,7 +154,7 @@ public function testGroupedFilterAdminUi() {
// Click the Expose filter button.
$this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/type', $edit, t('Expose filter'));
// Check the label of the grouped filters button.
$this->helperButtonHasLabel('edit-options-group-button-button', t('Grouped filters'));
$this->helperButtonHasLabel('edit-options-group-button-button', 'Grouped filters');

// Click the Grouped Filters button.
$this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/type');
Expand All @@ -169,7 +169,7 @@ public function testGroupedFilterAdminUi() {

// Check that after click on 'Grouped Filters', a new button is shown to
// add more items to the list.
$this->helperButtonHasLabel('edit-options-group-info-add-group', t('Add another item'));
$this->helperButtonHasLabel('edit-options-group-info-add-group', 'Add another item');

// Validate a single entry for a grouped filter.
$this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/filter/type');
Expand Down

0 comments on commit ec77b2e

Please sign in to comment.