Commit 71e46afe authored by Getulio Valentin Sánchez's avatar Getulio Valentin Sánchez
Browse files

Issue #2992914: Implement new Social Auth base test

parent 00f98c78
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\social_auth_uber\Functional;

use Drupal\Tests\social_auth\Functional\SocialAuthTestBase;

/**
 * Test that path to authentication route exists in Social Auth Login block.
 *
 * @group social_auth
 *
 * @ingroup social_auth_uber
 */
class SocialAuthUberLoginBlockTest extends SocialAuthTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = ['block', 'social_auth_uber'];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $this->provider = 'uber';
  }

  /**
   * Test that the path is included in the login block.
   *
   * @throws \Behat\Mink\Exception\ResponseTextException
   */
  public function testLinkExistsInBlock() {
    $this->checkLinkToProviderExists();
  }

}
+22 −9
Original line number Diff line number Diff line
@@ -2,16 +2,17 @@

namespace Drupal\Tests\social_auth_uber\Functional;

use Drupal\social_api\SocialApiSettingsFormBaseTest;
use Drupal\Tests\social_auth\Functional\SocialAuthTestBase;

/**
 * Test Social Auth Uber settings form functionality.
 * Test Social Auth Uber settings form.
 *
 * @group social_auth
 *
 * @ingroup social_auth_uber
 */
class SocialAuthUberSettingsFormTest extends SocialApiSettingsFormBaseTest {
class SocialAuthUberSettingsFormTest extends SocialAuthTestBase {

  /**
   * Modules to enable.
   *
@@ -24,28 +25,40 @@ class SocialAuthUberSettingsFormTest extends SocialApiSettingsFormBaseTest {
   */
  protected function setUp() {
    $this->module = 'social_auth_uber';
    $this->socialNetwork = 'uber';
    $this->moduleType = 'social-auth';
    $this->provider = 'uber';

    parent::setUp();
  }

  /**
   * {@inheritdoc}
   * Test if implementer is shown in the integration list.
   */
  public function testIsAvailableInIntegrationList() {
    $this->fields = ['client_id', 'client_secret'];
    parent::testIsAvailableInIntegrationList();

    $this->checkIsAvailableInIntegrationList();
  }

  /**
   * {@inheritdoc}
   * Test if permissions are set correctly for settings page.
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   * @throws \Behat\Mink\Exception\ExpectationException
   */
  public function testPermissionForSettingsPage() {
    $this->checkPermissionForSettingsPage();
  }

  /**
   * Test settings form submission.
   */
  public function testSettingsFormSubmission() {
    $this->edit = [
      'client_id' => $this->randomString(10),
      'client_secret' => $this->randomString(10),
    ];
    parent::testSettingsFormSubmission();

    $this->checkSettingsFormSubmission();
  }

}