Commit bc2eb65d authored by nikunj's avatar nikunj
Browse files

Issue #3027033: Coding standard issues in tests, demo form

parent d660624b
......@@ -4,7 +4,6 @@ namespace Drupal\clientside_validation_demo\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\link\LinkItemInterface;
/**
* Class ClientsideValidationDemoForm.
......@@ -108,7 +107,7 @@ class ClientsideValidationDemoForm extends FormBase {
'#required' => FALSE,
];
$form['phone_1'] = array(
$form['phone_1'] = [
'#type' => 'textfield',
'#title' => t('Phone Number'),
'#size' => 60,
......@@ -116,7 +115,7 @@ class ClientsideValidationDemoForm extends FormBase {
'#pattern' => "[789][0-9]{9}",
'#required' => TRUE,
'#placeholder' => t('Enter Phone Number - [789][0-9]{9}'),
);
];
$form['submit'] = [
'#type' => 'submit',
......@@ -139,7 +138,6 @@ class ClientsideValidationDemoForm extends FormBase {
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
}
}
......@@ -21,6 +21,8 @@ class ClientsideValidationTest extends JavascriptTestBase {
protected $adminUser;
/**
* DocumentElement object.
*
* @var \Behat\Mink\Element\DocumentElement
*/
protected $page;
......@@ -68,7 +70,7 @@ class ClientsideValidationTest extends JavascriptTestBase {
// Default required field error from email_1.
$assertions['edit-email-1'] = 'E-Mail 1 is required.';
$this->_validateAssertions($assertions);
$this->validateAssertions($assertions);
// URL field.
$assertions = [];
......@@ -77,7 +79,7 @@ class ClientsideValidationTest extends JavascriptTestBase {
$this->page->findById('edit-url')->setValue('invalid url');
$assertions['edit-url'] = 'URL does not contain a valid url.';
$this->_validateAssertions($assertions);
$this->validateAssertions($assertions);
// E-Mail field.
$assertions = [];
......@@ -90,7 +92,7 @@ class ClientsideValidationTest extends JavascriptTestBase {
$this->page->findById('edit-email-2')->setValue('asdf');
$assertions['edit-email-2'] = 'E-Mail 2 does not contain a valid email.';
$this->_validateAssertions($assertions);
$this->validateAssertions($assertions);
// Numeric field.
$assertions = [];
......@@ -111,7 +113,7 @@ class ClientsideValidationTest extends JavascriptTestBase {
$this->page->findById('edit-phone-1')->setValue('abc');
$assertions['edit-phone-1'] = 'Phone Number does not meet the requirements.';
$this->_validateAssertions($assertions);
$this->validateAssertions($assertions);
// Set all valid values.
$this->page->findById('edit-text-1')->setValue('text 1');
......@@ -143,7 +145,7 @@ class ClientsideValidationTest extends JavascriptTestBase {
* @throws \Exception
* Exception if element not found.
*/
private function _validateAssertions(array $assertions) {
private function validateAssertions(array $assertions) {
// Trigger click of submit button.
$this->page->findButton('Submit')->click();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment