Support from Acquia helps fund testing for Drupal Acquia logo

Comments

naveenvalecha created an issue. See original summary.

joyceg’s picture

Assigned: joyceg » naveenvalecha
Status: Active » Needs review
FileSize
616 bytes

Added a test to check the accessibility of the form.

naveenvalecha’s picture

Assigned: naveenvalecha » joyceg
Status: Needs review » Needs work
  1. --- /dev/null
    +++ b/src/Tests/searchTest.php
    

    File name should be better "SearchConfigFormTest.php"

  2. +++ b/src/Tests/searchTest.php
    @@ -0,0 +1,21 @@
    +/**
    + * @file
    + * Contains \Drupal\search_config\Tests\searchTest.
    + */
    

    This is not needed anymore. Remove @file tag.

  3. +++ b/src/Tests/searchTest.php
    @@ -0,0 +1,21 @@
    + * @group Drupal\search_config\Tests
    

    group is wrong. it should be "search_config"

  4. +++ b/src/Tests/searchTest.php
    @@ -0,0 +1,21 @@
    + public function testSearchConfigURL() {
    

    Add description about the function.

joyceg’s picture

Assigned: joyceg » Unassigned
Status: Needs work » Needs review
FileSize
628 bytes
joyceg’s picture

Assigned: Unassigned » naveenvalecha
joyceg’s picture

Assigned: naveenvalecha » joyceg
Status: Needs review » Needs work

sorry wrong patch attached.

joyceg’s picture

FileSize
658 bytes
joyceg’s picture

joyceg’s picture

Assigned: joyceg » naveenvalecha
Status: Needs work » Needs review
joyceg’s picture

Can you please review patch #8?

joyceg’s picture

If you are free, can you have a look at the patch #8 and suggest changes?

joyceg’s picture

Assigned: neetu morwani » joyceg
Status: Needs review » Active
FileSize
3.21 KB
joyceg’s picture

Assigned: joyceg » Unassigned
Status: Active » Needs review
neetu morwani’s picture

@joyce Can we also include the test for the SettingsForm if it is being submitted on entering the values or not.

neetu morwani’s picture

Status: Needs review » Needs work
joyceg’s picture

Status: Needs work » Needs review
FileSize
3.58 KB
naveenvalecha’s picture

Status: Needs review » Needs work
  1. +++ b/search_config.info.yml
    @@ -6,3 +6,4 @@ configure: entity.search_page.collection
    +files[]: src/Tests/SearchConfigFormTest.php
    

    Not needed. Remove it.

  2. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,62 @@
    + * Class searchTest
    

    Add one line description about the test file what it does

  3. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,62 @@
    + */
    

    Define the setup function and create a admin user.

  4. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,62 @@
    + public static $module = ['search_config'];
    

    Add a newline before it.

  5. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,62 @@
    + public function testSearchConfigURL() {
    +  $this->drupalGet('admin/config/search/pages');
    +  $this->assertResponse(200);
    + }
    

    Not needed.

  6. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,62 @@
    +  $this->drupalGet('admin/config/search/pages');
    +  $this->assertText('Keywords','Keywords field is present.');
    +  $this->assertFieldByName('search_config_string_overrides[labels][basic]', '', "The Keywords field is present.");
    +  $this->assertFieldByName('search_config_string_overrides[labels][basic_with_keys]', '', "The Keywords with search keys field is present.");
    +  $this->assertFieldByName('search_config_string_overrides[labels][basic_submit]', '', "The basic submit field is present.");
    +  $this->assertFieldByName('search_config_string_overrides[labels][advanced_fieldset]', '', "The wrapping field set field is present.");
    +  $this->assertFieldByName('search_config_string_overrides[labels][advanced_fieldset_with_keys]', '', "The wrapping field set with search keys field is present.");
    +  $this->assertFieldByName('search_config_string_overrides[labels][advanced_any]', '', "The containing any field is present.");
    +  $this->assertFieldByName('search_config_string_overrides[labels][advanced_phrase]', '', "Containing the phrase field is present.");
    +  $this->assertFieldByName('search_config_string_overrides[labels][advanced_type]', '', "The types field is present.");
    +  $this->assertFieldByName('search_config_string_overrides[labels][advanced_language]', '', "The language selecter field is present.");
    +  $this->assertFieldByName('search_config_string_overrides[labels][advanced_submit]', '', "The advanced submit button field is present.");
    

    Move all this to a single method testSearchConfigForm

  7. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,62 @@
    +  $this->drupalGet('admin/config/search/pages');
    +  $this->assertFieldChecked('Keywords','The keywords configuration has been selected');
    +  $this->assertFieldChecked('Containing any ...','The Containing any ... configuration has been selected');
    +  $this->assertFieldChecked('Containing the phrase','The Containing the phrase configuration has been selected');
    +  $this->assertFieldChecked('Containing none','The Containing none configuration has been selected');
    +  $this->assertFieldChecked('Types','The types configuration has been selected');
    +  $this->assertFieldChecked('Langugage selector','The language selector configuration has been selected');
    +  $this->assertFieldChecked('admin_bypass','The admin bypass configuration has been selected');
    

    Move this to a single method testSearchConfigForm

  8. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,62 @@
    +  ¶
    

    Extra spaces.

  9. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,62 @@
    + public function testFieldEntry() {
    

    Merge this method as well in another method.

  10. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,62 @@
    +  $edit = array();
    +  $edit['basic'] = '';
    +  $edit['basic_with_keys'] = '';
    +  $edit['basic_submit'] = '';
    

    Add some default values.

naveenvalecha’s picture

Assigned: Unassigned » joyceg
joyceg’s picture

Assigned: joyceg » Unassigned
Status: Needs work » Needs review
FileSize
3.21 KB
naveenvalecha’s picture

Assigned: Unassigned » joyceg
Status: Needs review » Needs work
  1. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,61 @@
    + public $admin;
    

    add @docblock to this property.

  2. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,61 @@
    + public function setUp()
    

    Add a new line before the function.

  3. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,61 @@
    +   'administer users',
    +   'administer permissions'
    

    Why these permissions. Search configuration form only needs this permission to access it "admin node search exclusions"

  4. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,61 @@
    +  $this->drupalGet('admin/config/search/pages');
    +  $edit = array();
    +  $edit['basic'] = '';
    +  $edit['basic_with_keys'] = '';
    +  $edit['basic_submit'] = '';
    +  $this->drupalPost('admin/config/search/pages', $edit, t('Save configuration'));
    

    Move this to above funtion 'testSearchConfigForm'

joyceg’s picture

Assigned: joyceg » Unassigned
Status: Needs work » Needs review
FileSize
3.15 KB
naveenvalecha’s picture

Assigned: Unassigned » joyceg
Status: Needs review » Needs work
  1. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,56 @@
    + * @docblock $admin
    + * New user has been created with admin node search exclusions permissions to test the form.
    

    This should be above the public $admin

  2. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,56 @@
    + public $admin;
    

    rename variable to $adminUser

  3. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,56 @@
    +  * To check the presence of configuration fields
    

    The description of the function name needs updation.

  4. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,56 @@
    +  $edit['basic'] = '';
    +  $edit['basic_with_keys'] = '';
    +  $edit['basic_submit'] = '';
    

    Why empty values

  5. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,56 @@
    + }
    

    Check here using $this->assertText('The configuration has been saved')
    that the page has been saved or not ?

joyceg’s picture

Assigned: joyceg » Unassigned
Status: Needs work » Needs review
FileSize
3.33 KB
naveenvalecha’s picture

Assigned: Unassigned » joyceg
Status: Needs review » Needs work
  1. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,59 @@
    + public static $module = ['search_config'];
    

    Add onel ine doc to
    /**
    * Modules to enable.
    *
    * @var array
    */

  2. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,59 @@
    +  * @docblock $adminUser
    +  * New user has been created with admin node search exclusions permissions to test the form.
    

    /**
    * An admin user with administrative permissions for Search Config.
    *
    * @var \Drupal\user\UserInterface
    */

  3. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,59 @@
    + public function setUp()
    

    /**
    * {@inheritdoc}
    */

  4. +++ b/src/Tests/SearchConfigFormTest.php
    @@ -0,0 +1,59 @@
    +  $this->assertText('The configuration has been saved');
    

    This would be the assertText

    $this->assertText('The configuration options have been saved.');

joyceg’s picture

Assigned: joyceg » Unassigned
Status: Needs work » Needs review
FileSize
3.44 KB
naveenvalecha’s picture

Assigned: Unassigned » joyceg
Status: Needs review » Needs work
+++ b/src/Tests/SearchConfigFormTest.php
@@ -0,0 +1,69 @@
+  * @docblock $adminUser

Remove this line.

naveenvalecha’s picture

Assigned: joyceg » Unassigned
Status: Needs work » Needs review
FileSize
3.44 KB

Addressed above and fixed coding standards in whole file.

Enabled drupal ci for testing .Giving it a run on it.

naveenvalecha’s picture

The attached patch will also fail b/c there's improper usage of the config api, that would be fixed and after that the tests will pass. Re-uploading the patch after cleanup.

naveenvalecha’s picture

Assigned: Unassigned » joyceg

Assigning to Joy to find the improper usage of config api and then fix it.

The last submitted patch, 27: 2771663-27.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 28: 2771663-29.patch, failed testing.

naveenvalecha’s picture

Status: Needs work » Needs review
FileSize
9.72 KB

More cleanup

Status: Needs review » Needs work

The last submitted patch, 32: 2771663-31.patch, failed testing.

naveenvalecha’s picture

Status: Needs work » Needs review
FileSize
9.72 KB

Status: Needs review » Needs work

The last submitted patch, 34: 2771663-33.patch, failed testing.

joyceg’s picture

The patches were not getting applied.

naveenvalecha’s picture

have you done the git pull before applying

joyceg’s picture

Yes, the git pull was done.

naveenvalecha’s picture

Status: Needs work » Needs review
FileSize
9.23 KB

More cleanup.

naveenvalecha’s picture

Go to the https://simplytest.me/project/search_config/8.x-1.x
and in the patch section give the link of the page https://www.drupal.org/files/issues/2771663-36.patch
It will apply and then setup the site for you.
you have some issues at local, resolve it and then apply the patch

Status: Needs review » Needs work

The last submitted patch, 39: 2771663-36.patch, failed testing.

joyceg’s picture

Yes, the patch is working fine. Some issues initially in my local. It has been resolved.

naveenvalecha’s picture

Splitting some of the related changes to sub issues.

naveenvalecha’s picture

FileSize
4.33 KB
naveenvalecha’s picture

Status: Needs work » Needs review
FileSize
3.44 KB

Status: Needs review » Needs work

The last submitted patch, 45: 2771663-44.patch, failed testing.