You are here

class LinkedinAuthManagerTest in Social Auth LinkedIn 8

@coversDefaultClass Drupal\social_auth_linkedin\LinkedinAuthManager @group social_auth_linkedin

Hierarchy

Expanded class hierarchy of LinkedinAuthManagerTest

File

tests/src/Unit/LinkedinAuthManagerTest.php, line 12

Namespace

Drupal\Tests\social_auth_linkedin\Unit
View source
class LinkedinAuthManagerTest extends UnitTestCase {

  /**
   * Session object.
   *
   * @var \Symfony\Component\HttpFoundation\Session\Session
   */
  protected $session;

  /**
   * Request object.
   *
   * @var \Symfony\Component\HttpFoundation\Request
   */
  protected $request;

  /**
   * Google Client object.
   *
   * @var \Google_Client
   */
  protected $client;

  /**
   * Linkedin Authentication manager.
   *
   * @var \Drupal\social_auth_linkedin\LinkedinAuthManager
   */
  protected $linkedinManager;

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    $this->request = $this
      ->getMock('\\Symfony\\Component\\HttpFoundation\\RequestStack');
    $this->linkedinManager = new LinkedinAuthManager($this->request);
    $this->client = $this
      ->getMockBuilder('\\LinkedIn\\LinkedIn')
      ->disableOriginalConstructor()
      ->getMock();
  }

  /**
   * Tests set Google_Client object.
   *
   * @covers ::setClient
   */
  public function testSetLinkedinClient() {
    $this
      ->assertInstanceOf('Drupal\\social_auth_linkedin\\LinkedinAuthManager', $this
      ->setClient());
  }

  /**
   * Sets \LinkedIn\LinkedIn object to LinkedinAuthManager.
   *
   * @return \Drupal\social_auth_linkedin\LinkedinAuthManager
   *   setClient() returns $this, the LinkedinAuthManager object.
   */
  protected function setClient() {
    return $this->linkedinManager
      ->setClient($this->client);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LinkedinAuthManagerTest::$client protected property Google Client object.
LinkedinAuthManagerTest::$linkedinManager protected property Linkedin Authentication manager.
LinkedinAuthManagerTest::$request protected property Request object.
LinkedinAuthManagerTest::$session protected property Session object.
LinkedinAuthManagerTest::setClient protected function Sets \LinkedIn\LinkedIn object to LinkedinAuthManager.
LinkedinAuthManagerTest::setUp protected function Overrides UnitTestCase::setUp
LinkedinAuthManagerTest::testSetLinkedinClient public function Tests set Google_Client object.
PhpunitCompatibilityTrait::getMock Deprecated public function Returns a mock object for the specified class using the available method.
PhpunitCompatibilityTrait::setExpectedException Deprecated public function Compatibility layer for PHPUnit 6 to support PHPUnit 4 code.
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root. 1
UnitTestCase::assertArrayEquals protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getBlockMockWithMachineName Deprecated protected function Mocks a block with a block plugin. 1
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getRandomGenerator protected function Gets the random generator for the utility methods.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::randomMachineName public function Generates a unique random string containing letters and numbers.