Write functional tests for checking whether the created routes exist or not and checking forms values whether they are saved correctly or not.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ankitjain28may created an issue. See original summary.

ankitjain28may’s picture

Status: Active » Needs review
FileSize
7.59 KB

Added tests for the verification of routes with and without admin permissions as well as check the affiliates product form by submitting data as well as check the edit and delete form too.
Please review.

ankitjain28may’s picture

Added image for the same.

borisson_’s picture

Status: Needs review » Needs work

This looks great! Awesome work already. I have some nits to pick, but otherwise this is good to go imho.

  1. +++ b/tests/src/Functional/ProductEntityFormTest.php
    @@ -0,0 +1,103 @@
    +  /**
    +   * Enabled modules
    +   */
    

    Should be {@inheritdoc}

  2. +++ b/tests/src/Functional/ProductEntityFormTest.php
    @@ -0,0 +1,103 @@
    +  function setUp() {
    

    Should contain the public keyword, so that is public function.

  3. +++ b/tests/src/Functional/ProductEntityFormTest.php
    @@ -0,0 +1,103 @@
    +    foreach (['edit', 'delete'] as $tab) {
    +      $this->drupalGet('/admin/structure/affiliates_product/1/' . $tab);
    +      $this->assertSession()->pageTextContains($formdata['name[0][value]']);
    +    }
    

    Awesome, that is a nice way to see if the links exist. ++

  4. +++ b/tests/src/Functional/ProductEntityFormTest.php
    @@ -0,0 +1,103 @@
    +    $this->getSession()->getPage()->pressButton('Delete');
    

    Let's go to the delete page again before going deleting the product. That way we can add new things in the list of tabs without having issues in this place.

  5. +++ b/tests/src/Functional/ProductEntityFormTest.php
    @@ -0,0 +1,103 @@
    +
    +
    +
    

    Should be only one line.

ankitjain28may’s picture

@borisson_ Thanks, I am making the changes.

ankitjain28may’s picture

Status: Needs work » Needs review
FileSize
7.61 KB
1.82 KB

Made changes as suggested, Please review.

ankitjain28may’s picture

Assigned: Unassigned » ankitjain28may
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, great work.

dbjpanda’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.